Subject: Re: strict_types or not?
From: Martin Baehr <mbaehr@email.archlab.tuwien.ac.at>
Date: Fri, 11 Aug 2006 AD 08:34:08 -0400

On Fri, Aug 11, 2006 at 02:16:12PM +0200, Henrik Grubbström wrote:
> On Fri, 11 Aug 2006, Martin Baehr wrote:
> Not from a typing perspective, the only thing the compiler knows at the 
> point it complains, is that you're attempting to call a function that 
> accepts a Human object with a variable that is typed as mixed. Since mixed 
> is a superset of object(Human) the code is allowed, due to the value 
> potentially containing only Human objects.

ok, that makes sense, however, what about the following then:
array(Human) pets = ({ Human(), Cat(), Dog() });

there is no mixed involved here, and the warning is:
An expression type array(object(is 65627) | object(is 65626) | object(is
65628)) cannot be assigned to a variable of type array({ Human =
object(implements 65628) })

there is no mixed involved here.

> >what would it take to make such warnings be errors?
> Why? It's not like the warnings are invisible.

but the program actually runs before i have a chance to check the
warnings, and see if they are relevant and possibly fix them.

> >btw, a way to just compile but never execute the code (to test for
> >errors) would also be useful...
> ? What's the problem?

the problem is that if the program crashes it could potentially
damage the data and leave it in an inconsistent state.

so i'd like to be able to avoid running the program until i have verified
that errors are gone and all warnings are accounted for.

quite often when i am developing a program i want to just see if it
compiles, even when the program is not yet ready to actually run
(because there are still missing components). without such an option i
can not test compliation unless i make sure that all statements that
actually change my data are deactivated, meaning that they don't get
tested.

greetings, martin.
-- 
cooperative communication with sTeam      -     caudium, pike, roxen and unix
offering: programming, training and administration   -  anywhere in the world
--
pike programmer   travelling and working in europe             open-steam.org
unix system-      bahai.or.at                        iaeste.(tuwien.ac|or).at
administrator     (caudium|gotpike).org                          is.schon.org
Martin Bähr       http://www.iaeste.or.at/~mbaehr/

Return to results