4 ms·
I enjoy seeing new experimental languages. I really enjoyed working through the README exercises. It's the perfect way to document and teach a language all in
by davegauer 9y ago
I enjoy seeing new experimental languages. I really enjoyed working through the README exercises. It's the perfect way to document and teach a language all in one go. The REPL worked great.
First, I love how you've chosen to have functions wait for the correct number of arguments to exist on the stack before executing. I've often pondered how to make Forth-like languages less painful to program - your solution is very clever!
Speaking of clever, I felt very clever indeed when I took your infix equality example:
| 42 == 42
[#t]
and it worked when re-ordered as postfix:
| 42 42 ==
[#t]
...indicating two things: 1) I actually understood what was happening and 2) the language is coherent.
It's great that basic IO so simple with 'say' and 'ask'. That allows somebody to jump in immediately and start making fun things!
| let name ask 'Who are you? ';
say $name
Love the syntax for lambdas: { ... }
What is the rationale for requiring function implementations of the same name to have the same arity? Nevermind! I just answered my own question: because functions need to know how many parameters to seek from the stack.
The literal values for function arguments is awesome - pattern matching!
I don't understand this example demonstrating an "index" for the function parameter types:
func: baz(x y Int z T0) $x + $y + $z;
I assume 'T0' is the aforementioned index? But I'm struggling to see how it works from this example. Maybe I'm just missing an idiom from some other language?
Bizarro Question: Is there any way you can 'delete' a function in the REPL? For example, to be able to re-use the name 'foo' as a function with a different arity. (It's fine if you can't. The ability would be useless in an actual program.)
You have an error in the README example for "Argument types may be specified in angle brackets...":
| &+<Int>
...
Error in row 1, col 6:
Func imp not found
But at least I was able to guess the correct syntax, yay!:
| &+<Int Int>
...
[Fimp(+ Int Int)]
Dates: I'm confused about the lack of a function called 'year' (singular) since 'day' and 'month' exist. Otherwise, I'm impressed. Dates are damned hard.
Everything about this language seems to be aimed at maximum brevity without sacrificing clarity. I like that a lot. Congratulations for getting this far and I'll definitely be bookmarking this.
I would love to see some longer programs written in Cixl to get a sense for what they look like and how they'd be structured.
How long have you been working on this? How long have you been dreaming about it? And how it is pronounced (SIX-el, KIX-el)?
- sifoo 9y agoIt's a work in progress, but this is the longest piece of code so far. It's the start of a simple booking system. https://github.com/basic-gongfu/cixl/blob/master/examples/bookings.cx https://github.com/basic-gongfu/cixl/blob/master/examples/bo...
- sifoo 9y agoFirst of all, thanks for taking the time. I'll try to address your questions in the same order, feel free to yell if I miss anything. 'T0' will be substituted for the type of the first parameter (indexing starts from 0) on evaluation, it's the most straight forward way of adding the constraint that two parameters need to be the same type without specifying which type. I should make the example clearer by specifying a less concrete type for x. Nope, no way right now. I realize it would be nice to have in the REPL but functions use their index in the list of implementations to implement upcall which means I have to figure out another way to do that fast for that to happen. The reason some fields have plural functions as well is because they have dual semantics. You have both the total number of days and the specific day of month, for example. The year only has one meaning. I guess you could alias 'years' to 'year', but then someone is going to wonder why it's there instead. There's some more material on the reasoning behind dates/times in /devlog. You pretty much nailed the heuristics I've been using to drive the design. It's been cooking for quite some time but I only started working on the implementation 3 weeks ago or so. It's slowly getting to the point where it's possible to write more interesting code. I'm waiting for a couple of bigger pieces to fall in to place first, structs are up next. The C in the name is derived from the host language, which would make that SIX-el.
- davegauer 9y agoParameter types: Okay, I'm closer to understanding: "T0" means "Type number 0". But I'm still confused by the example: func: baz(x y Int z T0) $x + $y + $z; z is the same type as the 0th type. I get that now. But what's confusing me is that it looks as if x's type is unspecified. The 'Int' here belongs to y, right? I'm sure I'll slap my forehead when it's explained to me... Dates: I see what you mean about there not being a "year of the _" semantically. But when formatting a date, I think of it as "year-month-day", not "years-month-day". You've made excellent progress in 3 weeks! Keep it up!