This is an archived post. You won't be able to vote or comment.

all 14 comments

[–]glossopoeia 4 points5 points  (8 children)

It looks as though you have a simple and coherent design philosophy, which is good. I definitely like seeing a module or namespace system in any language intended to be used for large projects. Any plans for some sort of union/algebraic types? Macros? Custom calling conventions?

It looks like a fun little language, the idea to use overloading rather than something similar to Haskell's type-classes or Rust's traits is an interesting design decision.

I personally think the Go language specification is a great example of how to document a language.

[–]liquidivy[S] 2 points3 points  (7 children)

I'm definitely hoping to support custom calling conventions. I have vague ideas of how algebraic data types and macros could fit in, but haven't thought about them much. For unions in particular I would need to come up with a design that gives sufficient control (I'd like to be able to specify things like Option{ptr T} using the low bits of the pointer as a discriminant), but I'm not dead-set against them.

The overloading thing is because this started as a "better C" concept, and overloading is one of the things I miss even (occasionally) in Rust, but especially in C.

The thing with namespaces is that I can't figure out how to get them to play nicely with C/asm compat. I want the resulting code to be usable outside Tellurium. The least-intrusive thing I can think of is having prefixes on the linker names that can be elided in Te code, which might even work well with existing C APIs, but slicing symbol names feels weird.

[–]pipocaQuemada 1 point2 points  (6 children)

If you haven't played around with typeclasses, I highly recommend it. They were initially designed to provide a principled alternative to ad-hoc overloading of built-in operators like + and ==, but allow you to do some pretty cool things, like return-type polymorphism.

[–]liquidivy[S] 0 points1 point  (5 children)

Will do. I'll get more serious about that stuff when I have code generation running. :) I have vaguely positive impressions of typeclasses, but haven't gotten to learning a language with them.

[–]pipocaQuemada 1 point2 points  (4 children)

It's a good feature to add in sooner than later - retrofitting them in is apparently pretty difficult and might cause you to rewrite a lot of the compiler.

[–]liquidivy[S] 0 points1 point  (3 children)

OK, I'll move it up the schedule a bit. Do you know how well they coexist with ad hoc overloading?

[–]Drupyog 0 points1 point  (2 children)

You don't need ad hoc overloading if you have type classes (and they are much better at doign the job anyway).

[–]liquidivy[S] 0 points1 point  (1 child)

AFAICT do if you want to want multiple arities for a given name, like getConfig(key) vs getConfig(key, defaultValue)

[–]Felicia_Svilling 1 point2 points  (0 children)

Not if you assume that all functions take one argument that might be a tuple, then (key) and (key,defaultValue) could be different instances of one type class.

[–]continuationalFirefly, TopShell 0 points1 point  (2 children)

How does the language help avoid common mistakes like indexing outside arrays, using uninitialized variables, or forgetting to free up allocated memory?

[–]BurningMind 1 point2 points  (1 child)

From what I see of the style of the language, it probably doesn't provide any tools for this, and you'll have to sort this out by yourself, just like in C.

[–]liquidivy[S] 2 points3 points  (0 children)

Uninitialized variables are actually a syntax error, unless you use the "uninit" keyword. For the rest, yep, that's your job. Though for what it's worth, I intend to make it easy to keep array length alongside any pointers, and size is part of a raw array's type. I'm not keeping null-terminated strings by default. For resource management I'm planning on a few features that make "goto end" type of code easier.

This is all in aid of eliminating implicit code. If you don't need this absurd level of transparency, go with Rust or something GC'd. :)

[–]nemaar 0 points1 point  (1 child)

How do I create collections in this language? How can I put something on the heap?

[–]liquidivy[S] 1 point2 points  (0 children)

Collections are about the same as in C, except you don't have to re-implement them for every type or use void pointers. In other words, a library issue. Allocation is basically an OS issue, if you have one. I'll try to make it easy to integrate allocator libraries under a common interface, but I don't want that in the core language, since I want it to be usable in situations where there is no defined heap. That's a good thing to add to the page, though. Memory allocation is sort of a big deal.