Why is '+' a method and not a generic function? 
Author Message
 Why is '+' a method and not a generic function?

Along the sames lines, I would be interested in knowing why '+' is
not simply syntax, rather than a method. It seems simpler for it to
just be syntax that translates to calls on (the generic function)
'binary+'. Similarly for the discussion (some time ago) on
associative methods.

--


Computer Engineering Computer Science
California State University Long Beach



Sun, 31 Dec 1995 06:05:46 GMT  
 Why is '+' a method and not a generic function?

   Date: Tue, 13 Jul 1993 22:05:46 GMT

   Along the sames lines, I would be interested in knowing why '+' is
   not simply syntax, rather than a method. It seems simpler for it to
   just be syntax that translates to calls on (the generic function)
   'binary+'. Similarly for the discussion (some time ago) on
   associative methods.

+ needs to be a first-class method (or generic function) because if it
was syntax it could not be used as an argument to, for example, apply
or map.  In general it couldn't be used as a functional object, and
there are no compelling benefits gained by giving up its functional
status.

Syntax is good mainly for control of evaluation, e.g. if, while, and,
or. The definition of + does not require evaluation to be anything
other than that defined for functional calls.
--

Mitron Corporation    (503) 690-8350    FAX: (503) 690-9292
15256 NW Greenbrier Pkwy, Beaverton, OR 97006



Sun, 31 Dec 1995 00:32:11 GMT  
 Why is '+' a method and not a generic function?

Quote:

> Along the sames lines, I would be interested in knowing why '+' is
> not simply syntax, rather than a method. It seems simpler for it to
> just be syntax that translates to calls on (the generic function)
> 'binary+'. Similarly for the discussion (some time ago) on
> associative methods.

Because they don't want to special-case lots of things like that in the
language semantics.  The semantics are of a method.  Any actual
implementation is likely to in-line the method code (which is simply a
call of the generic function 'binary+'), which has the same end effect
as what you want.


Sun, 31 Dec 1995 11:58:09 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Why is `+' a method and not a generic function?

2. Why is `+' a method and not a generic function?

3. 'bind' functions into methods

4. 'capwords' is not a string method

5. Why is interpreter not 'registered'?

6. What's a generic function?

7. The Smalltalk Store: Why we've been slow, and why we're getting better

8. Why JIT's may get more mainstream [was: Method lookup]

9. Why can't instance methods be pickled?

10. Language question : function'Access / function'unchecked_Access

11. (documentation 'some-function 'function)

12. Dylan ain't Smalltalk -- but why not?

 

 
Powered by phpBB® Forum Software