Path: news.daimi.aau.dk!news.uni-c.dk!sunic!news.luth.se!eru.mt.luth.se!bloom-beacon.mit.edu!cambridge-news.cygnus.com!news.cygnus.com!kithrup.com!news.Stanford.EDU!nntp.Stanford.EDU!rogoff From: rogoff@Lanczos.Stanford.EDU (Brian Rogoff) Newsgroups: comp.lang.beta Subject: Re: Value patterns in BETA? Date: 14 Feb 95 13:12:12 Organization: /u/rogoff/.organization Lines: 65 Message-ID: References: <3gsak5$j5b@engnews2.Eng.Sun.COM> <3hnskr$13m@belfort.daimi.aau.dk> Reply-To: rogoff@sccm.stanford.edu NNTP-Posting-Host: lanczos.stanford.edu In-reply-to: olevi@daimi.aau.dk's message of 13 Feb 1995 15:08:11 GMT In article <3hnskr$13m@belfort.daimi.aau.dk> olevi@daimi.aau.dk (Ole Villumsen) writes: Brian Rogoff writes: >I asked about this some time ago, and I was told that there is indeed a tag >in Mjolner BETA. Is this the case? Yes: there is a small space overhead for every object in a BETA program. There is no *time* penalty, as far as I know. More on this later in the article. Ole and I exchanged a few e-mails on this, parts of which I'll include (with his permission) below. >In article <3gsak5$j5b@engnews2.Eng.Sun.COM> olm@Eng.Sun.COM (Ole Lehrmann Madsen) writes: > p1 -> p2.add -> p3 > but if you mean operator overloading like > p1 + p2 -> p3 I'd prefer (p1,p2) -> add -> p3 , which is possible in BETA. That's fine, as long as all of the basic numeric patterns use the same names. >That wasn't part of my original question, but your prescience is amazing >because I was wondering about that too! I agree that real overloading may >be kind of heavy for BETA, but how about some kind of Eiffel 3 style >ability to declare new binary operators without ad-hoc polymorphism? I Not knowing Eiffel 3, I can't answer your question here. I was just thinking that the syntactic sugar of being able to make up infix operators would be nice, even if it were not accompanied by "ad-hoc" polymorphism, which can also be nice for scientific programming -- Ole Villumsen, Computer Science Department, Aarhus University, Denmark - no, not *that* Ole :-) "When God created time, he created enough of it." In an e-mail message Ole writes, in response to my query about whether the small space overhead occurs once per "Matrix of MyComplex" or for every "MyComplex" in the Matrix: But I'll have to disappoint you: the penalty comes with *each object*. I think it's 16 bytes or so - I never understood why it had to be so much; but I could be wrong about the amount. No way I know of to "untag" patterns or objects, except hand-build the data structure using only basic types. There is no penalty with those (integer, real, boolean, char). I'll elaborate in the news. Ole That is too much. A "Matrix of MyComplex" is 3 times as big as it needs to be (assuming 2 4 byte floats for the complex and a tagless reresentation). I am willing to surrender some flexibility and extensibility for speed and space. I believe that it is possible to have at least some amount of genericity, i.e., to be able to write a generic NumericMatrix, and not have to have tags if I am willing to surrender the ability to do OO dispatch on the type. -- Brian