Re: Re: OO in Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg37618] Re: [mg37578] Re: OO in Mathematica
- From: Sseziwa Mukasa <mukasa at jeol.com>
- Date: Wed, 6 Nov 2002 06:57:58 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
On Tuesday, November 5, 2002, at 05:01 AM, Nafod40 wrote: > Andrzej Kozlowski <andrzej at tuins.ac.jp> wrote in message > news:<apvei5$s32$1 at smc.vnet.net>... >> On Thursday, October 31, 2002, at 10:59 PM, Hermann Schmitt wrote: >> >>> My point is, that Mathematica is not based on functional programming. >>> Mathematica is essentially a set of instructions, which can be >>> structured >>> into programs in several ways. >> >> They are missing presumably because >> people at WRI do not think they would make a tremendous addition to >> Mathematica's capabilities. I also share this view, which does not >> mean >> that less than world shattering addition would not be interesting and >> useful. > > As one voice in the wilderness, I would be THRILLED for some OOP > constructs in Mathematica, primarily to make my code more readable. We > do a lot of rule capture for engineering systems, and support for > STRUCTs or STRUCT-like entities would help. > > But what's wrong with defining fields as upvalues of a head indicating the record type? If you use the model demonstrated by Orestis (unfortunately due to the change in subject lines this thread seems to have split into 4 separate ones) you can inherit structure and methods etc. I know Orestis used downvalues but I think upvalues would be more efficient. I'd also change his method to use a symbol without a definition rather than overloading Dot. If you are using Mathematica you already have to condition yourself to use Map, Fold et al. rather than Do, For, While etc. What's wrong with using pattern matching for structures instead of tuples? Regards, Ssezi