Bill Page wrote:
> 
> On 28 October 2016 at 22:16, Waldek Hebisch <hebi...@math.uni.wroc.pl> wrote:
> >
> > BTW2: The desion goal of FriCAS typesystem was that anwer to
> > questions like 'sameType?' should be mostly statically known,
> > without need for runtime tests (I write "mostly" because
> > Union-s require some testing).
> >
> 
> What testing is required for Union? For example if
> 
>   x:Union(Integer,Float)
> 
> then the static type of x is just 'Union(Integer,Float)' for ALL
> values x. Whether we can produce a given value by coercing an Integer
> or a Float is not part of the type information, is it?

Formally type of 'x' is just Union, so you are right that no
dynamic checking is needed to know static type of 'x'.  OTOH
brach of union is part of type information: Spad compiler
will allow coercion of 'x' to Integer only if you earlier
checked that 'x' can be coerced to Integer.  Pragmatically,
'x case T' is used in places where other systems may have
dynamic type checks.  To put it differently, static
typing alone will not eliminate need satified by type checks
in dynamically typed language.  Of course some type
checks are just result of poor program organization.
Many type checks will go away due to overloading.
But there is important class of type checks that can not
be easily eliminated.  In such cases tests using 'case'
may do.  Or as last defence one may be forced to use 'Any'...

-- 
                              Waldek Hebisch

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to fricas-devel+unsubscr...@googlegroups.com.
To post to this group, send email to fricas-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to