on the Curl Web Content Markup Language

on the Curl Web Content Markup and Programming Language from www.curl.com and www.curlap.com

Wednesday, June 27, 2012

Curl versus prototype.js

Here is what the prototype.js site suggests:

var Person = Class.create({
  initialize: function(name) {
    this.name = name;
  },
  say: function(message) {
    return this.name + ': ' + message;
  }
});

var Pirate = Class.create(Person, {
  say: function($super, message) {
    return $super(message) + ', yarr!';
  }
});

Here is my Curl equivalent

{define-class public Person
  field public-get private-set name:String
  {method public {say msg:String}:String
    {return {String self.name, ": ", msg}}
  }
  {constructor {default name:String}
    set self.name = name
  }
}

{define-class public Pirate {inherits Person}
  {constructor {default name:String}
    {construct-super name}
  }
  {method public {say msg:String}:String
    {return {String {super.say msg}, ", yarr!"} }
  }
}

Now here is my naive test code:
{output {{Pirate "Long-John"}.say "ahoy matey"}}
and here is the output:
Long-John: ahoy matey, yarr!

Note the lack of sigil's, var's and strange parenthetical matings.
But Curl also has 3D graphics and 2D paths and db interfaces and an IDE ... and now generates Android app's. Oh ... and a debugging environment with graphical inspectors and color outline  and fill debug inspection highlighters ... and is almost Smalltalk-ish LISP.
And from the same DARPA project as WWW.  SCSK Curl  (formerly MIT Curl).
Did I mention multiple inheritance? Mix-in's ? Anonymous proc's? Async workers?

{after (10s * long-wait) do
   {more-than-HTML-JS-lib for-the-web}
}
|| public classes, library classes, packages, imports, includes, macros, enums, Array-2-of
|| abstract classes, final classes, sealed classes, shared, serializable,deprecated,open ...

1 comment:

  1. And prototype.js is not all that their own web pages load as a JS script ... not that the curlap.com web pages are not themselves a web 'glass house' as much as the curl.com pages. Ahem.

    ReplyDelete