[LLVMdev] My LLVM Project

Renato Golin rengolin at systemcall.org
Tue Sep 15 02:06:56 PDT 2009


2009/9/15 Talin <talin at acm.org>:
> For example, here's what the "Iterator" interface looks like:
>
>   interface Iterator[%T] {
>     def next -> T or void;
>   }

So this would be something like:

template <class T>
virtual class Iterator {
  T next(); // or void?
};

So the power of having two types of return parameters is that you save
function calls (hasNext())?


>   def sum(nums:int...) -> int {
>     var sum = 0;
>     for i in nums {
>       sum += i;
>     }
>     return sum;
>   }

I see you don't have types for variables, only for containers,
templates and functions. And yet you say your language is
statically-typed. If you do:

var foo = 10; // I'd presume it's an int
foo /= 3;

Would foo become a float?

foo /= 1e200;

Would it become a double?

What happens if you pass foo as an int, and inside the function it
becomes a double (without your consent, by a combination of
parameters) and you try to return it as an int?


> 'classify' is like a switch statement, except that the cases are types
> rather than values. It works with both disjoint types and polymorphic
> types, similar to what is seen in Scala and various functional languages
> such as OCaml. The variables in the individual 'as' clauses are never in
> scope unless the assignment to that variable actually succeeds, so
> there's no chance of seeing an uninitialized variable.

Is it run-time or compile-time? The former is Java's insanceof/C++
RTTI, the later has not many uses...


> In any case, I don't want to go on about this too long - at least not
> until the compiler is in better shape to be shown to the world. I still
> need to work on closures, reflection, garbage collection, interface
> proxies, stack dumps, debug info, and a bunch of other stuff. (There's a
> Google code project for it, but I'm not encouraging people to go there
> until I have more of the language finished.)

I think it's great to write compilers to learn how languages work (I'm
doing my own too).

My points about the language:

First, It's much more like a cross between Python/Perl and Java than
C++. It's not strongly typed and yet it use generic programming. As
long as it's not creating *types* with templates (like C++) but
creating only generic algorithms (like Java), it's ok.

It has too much syntactic sugar and names changed for no apparent
reason, it drives the user away from using your language. A good deal
of Java's success is because they used a syntax very similar to C++.

My (very personal) point of view is that, if you're not bringing
anything new, help the others that are instead of re-inventing the
wheel. But again, if your point is (as mine) to learn, well done! It's
much better than my own language! ;)

cheers,
--renato

Reclaim your digital rights, eliminate DRM, learn more at
http://www.defectivebydesign.org/what_is_drm




More information about the llvm-dev mailing list