Re: lang effort: type conversions



cr88192 wrote:
if anyone cares (or wants to make comment), after working some more of the
inferencer for the lang I am implementing, I have started to consider some
rules.


in its basic semantics, the lang will be dynamically typed with a prototype
object system, however, the lang will also have the ability to define static
types and use them for basic optimizations.

at this point in time, a lot of type violations aren't caught, and those
that are often only generate warnings. this may change eventually (it is
still the first month of implementation).


the basic syntax is more or less c style, and similar goes for declarations:
int x;
int fib(int x)if(x>2)fib(x-1)+fib(x-2) else 1;

there will also the variant type ('var'), which may take any other type, and
will not have many of the same restrictions as the other types.

in the case of functions, types may be ommited:
fact(x)if(x>1)x*fact(x-1) else 1;
in which case, variant will be assumed (unless the inferencer thinks
otherwise).

in the case of variables, a type is still required so that the parser is
sure that it is a definition, eg:
var x;
is that your entire type system? It seems pretty limited to me.

most casts will be implicit, but an explicit cast may be written as the type
name followed by an expression:
(long 3)/4.
There's no need for casting in a dynamic language. That's a conversion
:) Also, if you have special syntax just to convert between built-in
types, I don't like it.

.