Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: fyi, small note on using Mathematica for object based programming
Replies: 3   Last Post: Apr 14, 2012 3:13 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Vince Virgilio

Posts: 135
Registered: 4/30/05
Re: fyi, small note on using Mathematica for object based programming
Posted: Apr 14, 2012 3:13 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On Thursday, April 5, 2012 5:54:06 AM UTC-4, Nasser M. Abbasi wrote:
> Just FYI,
>
> I wrote this small note on using Mathematica for object-based
> programming. I found that it works really well for me.
>
> Nothing too advanced, just a simple way of using Module[] but
> in a way to emulate object based programming that I did not know
> about before.
>
> http://12000.org/my_notes/object_based_in_mathematica/v1.html
>
> --Nasser


I like it, and it resembles a technique that I've been using for several years.

I called my version "Loom" (Lightweight Objects and Options in Mathematica). In addition to encapsulating state through convenient closures, and providing simpler syntax for option handling, it enables another level of granularity in package files. So packages can grow quite large this way (I like single-file deployments). Large packages remain easy to read with the lexical "locality" provided by Loom without burdening symbol syntax. There are no special operators---just a few infrequent keywords: 'static', 'class', and 'type'. There is provision for inheritance and upcalls which I rarely use (keyword 'super', largely untested).

Loom grew out of need in my application development; it was not forced from a desire to imitate a particular paradigm. It has proven itself over time in a variety of modeling, simulation, and analysis tasks.

But! I do not see an easy way to implement /automatic/ serialization of objects with this approach. The reliance on $ModuleNumber for pseudo-pointers
throws a wrench in it, I think.

I'm glad Nasser documented his version. Someday I might document mine.

Vince Virgilio




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.