"Bill Page" <[EMAIL PROTECTED]> writes:

[...]

| >  | Really should have written '_+$Integer'
| >  | instead of just '+'
| >  |
| >  | (2) -> myreduce(_+$Integer,[])
| >  |    Compiling function red with type (((Integer,Integer) -> Integer),
| >  |       List None) -> Integer
| >  |
| >  |    (2)  0
| >  |                                                      Type: 
NonNegativeInteger
| >
| >  Even there, I would have expected a type error.  The type of the
| >  operation does not match the type of the contained element (None).
| >
| 
| Agreed. The interpreter should have smarter but of course I did not
| give it enough information. In the interpreter when I write:
| 
|   red(f,x) == ...
| 
| I am not really giving a *function* definition. Since no types are
| specified this construction is usually called a "mode", I think. But

Yes, it isn't essentially that different from a function.  A mode is
permitted to have holes in it (filled in by the type inferencer), and
therefore can have many instantiations.

| even if I am completely specific so that the interpreter has no
| choice, then the result is that same - although apparently now
| type-correct:
| 
| (5) -> red(f:(INT,INT)->INT,x:List INT):INT==(#x>1 => f(first x,red(f,rest 
x));
| #x=1 => first x; f=_+$INT => 0; f=_*$INT => 1;error "use: reduce(op,list,id)")
|    Function declaration red : (((Integer,Integer) -> Integer),List
|       Integer) -> Integer has been added to workspace.
|    Compiled code for red has been cleared.
|    1 old definition(s) deleted for function or rule red
|                                                                    Type: Void
| (6) -> red(_+$Integer,[])
|    There is more than one * in the domain or package Integer . The one
|       being chosen has type ((Integer,Integer) -> Integer) .
|    Compiling function red with type (((Integer,Integer) -> Integer),
|       List Integer) -> Integer
| 
|    (6)  0
|                                                      Type: NonNegativeInteger
| 
| Notice however the new warning message.

Yes.

[...]

| Could you be more specific? Would you expect Spad to be able to
| compile this or not?

My view is that it is a bug in the compiler.

-- Gaby

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
open-axiom-devel mailing list
open-axiom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open-axiom-devel

Reply via email to