Showing posts with label IO. Show all posts
Showing posts with label IO. Show all posts

Friday, December 10, 2010

Inspecting Global Variables in Pharo Smalltalk 1.1.1

I cannot resist posting this: it creates an interable collection of associations of all current global identifiers and their current types:

"A recipe from Squeak wiki at http://wiki.squeak.org/squeak/1824

Smalltalk keys select:
   [:k | ((Smalltalk at: k) isKindOf: Class) not]
     thenCollect:
        [:k | k -> (Smalltalk at: k) class]


"The code is in SystemDictionary's class comment."

Smalltalk implementations and VM's are evolving - but just compare what has to be done today in other dynamic languages to achieve the same ...

One notable exception is the Io Lobby object.  With a little care, the same result can be very succinct in Rebol 2.7.6. and even simpler in Rebol3.

Here is a node.js shell result on startup:
for (var s in process) { s}
'listeners'
In a Pharo One-Click I get an Array of 127 assocs.

Python does have dir(obj) which is hardly a Smalltalk inspection widget ...

in JavaScript there had been access to the Arguments object for a top-level function callee/caller to get into the activation/call object - But what will that kludge's fate be now that ECMAScript5 is here and Mozilla JavaScript 2.0 is coming?

In all fairness, in Smalltalk and Rebol the unwary traditionally can clobber anything.  But in Smalltalk you can inspect almost anything non-primitive - even during startup. And a bootstrapping JavaScript interpreter written in JavaScript achieves almost the same transparency.  See also: The avocado variant of Lively-Kernel.

see: JavaScript Function.call and Function.apply and ECMAScrip5 Function.prototype.bind

Friday, November 5, 2010

Seven Languages and a few questions

Pragmatic Programmer has published Bruce Tate's Seven Languages.  I have some reservations.

The languages are Clojure, Haskell, Io, Prolog, Scala, Erlang, and Ruby.  Looks cool.  But look again.

Clojure is something of a Lisp reincarnate.  Io and Ruby are botrh Smalltalk in another guise: Ruby is Smalltalk in files à la Perl; Dekorte's Io is Smalltalk-2 (Self) + actor (but not morphic - for which see one brand of Squeak Smalltalk.)

Erlang is best understood as Prolog reduced.  So what would have been beyond 1974 Prolog? Oz.  Or Mercury.  Or XSB.  Or think outside the box with a chapter on Logtalk instead.

Scala Traits come from Squeak Smalltalk, btw.

I have no quarrel with Haskell being there, though some would argue for OCaml.

But if LISP is not there, what is Prolog doing there?  Why not JESS or Drools instead?  And not a single expression-based language (Rebol, ICON/UNICON ( and now ObjectIcon and Converge) or MIT Curl, the language (ww.curl.com.)

With Ruby there, we at least have a reminder that performance matters - so maybe it should have been JRuby.  But I can imagine how Pythonists might feel incensed.

I would suggest 12 languages in 12 months or 3 languages in 3 months.

Take a moment to look at the comments on the Prolog N-Queens code.  Is Tate claiming that the two files in question are his copyrighted code?  Compare the ICON code for N-Queens and ask whether you wouldn't be better looking there for an alternative language on your shelf.  And Rebol 3 is really starting to take shape over at Rebol.net, Rebol.org and Rebol.com

Most CS folks recall the course in which they were required to do some Prolog.  But would they skip a chapter on JESS or Logtalk?

The real story in Prolog in the past 25 years is constraint resolution, and that can be seen best in Oz.  But the reader will have to use emacs.  Oops.

I don't mean to knock Amzi! Prolog for Eclipse or many of the excellent Prolog projects such as swi-prolog.org (now with UNICODE and constraint-handling rules) but I would argue that what makes SWI interesting is Logtalk - and if there is RDF in the picture, that points to XSB.

Clojure, Haskell, Io, XSB, Scala, Erlang, JESS and JRuby in 8 weeks.  Ok, now I'm more likely to recommend a book.

"Clojure, F#, Io, Oz, Scala, Erlang, and JRuby in 7 months".  Call it "between vacations reading-and-testing-and-coding-and-designing".  And you would have my attention.

And whatever became of Tcl ( it only gave us Tk, Expect, Sqlite and now TclOO.)  Oops.

Oh, and Mercury now generates Erlang in addition to C or Java.

PS
Isn't concurrency coming to UNICON?  Isn't Oz now distributed Oz?  Isn't ObjectIcon at code.google.com/p/objecticon
Oh - right.  The cool factor.  And Smalltalk itself - after giving us so much and then the RefactoringBrowser and then UnitTest and pair-programming and eXtreme Programming and the wiki at c2.com ... is not yet cool again.  Might as well wait for Hermes2 on a non-Linux OS.
Oh - and Rebol is already PEG-equivalent at 300+ Kb core running with a claim to a whole 15 Mb of working memory.  Hmmm.

Saturday, February 9, 2008

CURL6 in the RIA news

There has been good news lately at the CURL.com site with Curl winning the InfoWorld 2008 RIA development platform award and with Richard Monson-Haefel coming on-board to replace the late Marc Orchant.
I continue to try to create the urban legend that CURL stands for {url

My latest enthusiasm is to see features of ICON and UNICON appear in CURL 7 as an alternative to regexp - an extension which would also see back-tracking added to CURL. There must be a way to start that rumor ...

Some other sites seem noticably quiet, such as VistaScript.net but I continue to watch the DLR site of IronPython.

It was also great to see a new Win32 package for IO available at iolanguage.com

And of course there is a lot of activity via the ALTME link of REBOL.net with the alpha-release of REBOL3 ... and that page has a link to Carl Sassenrath's Rebol3 Frontline blog.