On 02/18/2008 07:06 PM, Gabriel Dos Reis wrote:
> Ralf --
>
>   I seem to remember that you stated many times that the use of
> domain Any is a bit annoying.  Do you remember why?
>
> Thanks,
>
> -- Gaby

Already the name "Any" is misleading. Can I coerce

   1
   "blah"
   Integer
   SetCategory

to Any? Yes, I can (see end of mail), but I cannot put them all together
into a list. Strange?

But assume you have an element of type Any. What can you do with it?
So what should be the exports of Any?

Look for example at

         dom             : % -> SExpression
           ++ dom(a) returns a \spadgloss{LISP} form of the type of the
           ++ original object that was converted to \spadtype{Any}.
         obj             : % -> None
           ++ obj(a) essentially returns the original object that was
           ++ converted to \spadtype{Any} except that the type is forced
           ++ to be \spadtype{None}.

If
   a: Any
then we have
   obj(a): None

Suppose that originally the object was of type Integer? How do I find
this out? I cannot do anything reasonable with an element of type
"None". All I get from the function "dom" is an SExpression. What I need
is a domain not an SExpression. But if I want a domain, that domain must
be of a certain type. A category is missing here.

If you look into the Aldor documentation, you find the domain
constructor "Object".

svn cat
https://aquarium.aldor.csd.uwo.ca/svn/aldor/trunk/aldor/aldorug/samples/objectb.as
svn cat
https://aquarium.aldor.csd.uwo.ca/svn/aldor/trunk/aldor/aldorug/samples/objectr.as

I would rather prefer something like that.

"Any" is used in a typed language (SPAD) to forget about the type so
that one can form a list of objects of different types. And then
*magically* the interpreter is able to figure out the type of the
object. I am in favour of having a typed language without compromise.

The other unnecessary and equally problematic domain is "None".

Does that help?

Ralf


(1) -> i:Integer := 1

    (1)  1
                                   Type: Integer
(2) -> a1:Any := i

    (2)  1
                                   Type: Integer
(3) -> s: String := "blah"

    (3)  "blah"
                                   Type: String
(4) -> a2: Any := s

    (4)  "blah"
                                   Type: String
(5) -> a3: Any := Integer

    (5)  Integer
                                   Type: Domain
(6) -> a4: Any := SetCategory

    (6)  SetCategory
                                   Type: SubDomain Domain
(7) -> u: List Any := [a1,a2,a3,a4]

    Cannot convert an element of the construct to type Any .
(7) -> u: List Any := [a1,a2]
    (7)  [1,"blah"]
                                   Type: List Any
(8) -> u: List Any := [a1,a2,a3]

    Cannot convert an element of the construct to type Any .



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
open-axiom-devel mailing list
open-axiom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open-axiom-devel

Reply via email to