This is the mail archive of the guile@sources.redhat.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Scheme as an abstract syntax tree.


On Tue, Jul 11, 2000 at 01:58:32AM +0200, Jorgen 'forcer' Schaefer wrote:
> 
> (define (foo a) (+ a 1))
> 
> to do
> 
> puts [foo [expr 1+1]]
> 
> This does not really work this way, because in Tcl, everything's
> a string.  foo will get "1" (string) as argument, and complain.

Last time we had this discussion I suggested that generic
methods _may_ provide a sollution for this problem, _if_
someone is willing to rewrite most of the builtins to use
argument types :-)

Of course in the example above this wouldn't help; assuming
that "+" was generalized and that Guile knows what to do with
the expression (+ "2" 1), it would probably be "21" rather than
3. _But_, if we "decree" that Guile's flavour of Scheme
encourages the use of generics and type specifiers, then the
"bug" would be in "foo" because the developer should have
defined a to be an int ;-)

(The next step after generic methods and strong typing is
automatic conversion, like C++ does - so if there is a match
for (foo 1) but not for (foo "1") Guile would call some default
magic to try to coerce "1" into some type foo accepts...)

[]s,
                                               |alo
                                               +----
--
          Hack and Roll  ( http://www.hackandroll.org )
            News for, uh, whatever it is that we are.


http://zope.gf.com.br/lalo           mailto:lalo@hackandroll.org
         pgp key: http://zope.gf.com.br/lalo/pessoal/pgp

Brazil of Darkness (RPG)    ---     http://zope.gf.com.br/BroDar

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]