4 ms·
Show HN: Cixl – a minimal, decently typed scripting language
- maneesh 9y agoCool! Why'd you make it?
- sifoo 9y agoThe fact that no one else was doing it started to feel like an obligation. Cixl is an attempt to find a middle way; a more permissive, less religious, yet modern and convenient approach to solving problems in code. Unlike most other languages; it isn't very interested in reinventing or ruling the world; and doesn't mind being embedded in and extended from other languages.
- tytytytytytytyt 9y agoI was with you at first, but then your usage of semicolons went way overboard.
- sifoo 9y agoWhich usage of semicolons are you referring to? The only one I can think of is using them to terminate definitions. I realize it's slightly unorthodox, like most of cixl; but many languages seem to be fine with using semicolons to terminate every single freaking statement, how is this worse?
- davegauer 9y agoI believe the semicolons in question are in your comment, not in your language.
- sifoo 9y agoAh, epic swoosh :) They fill a clear purpose as a step between commas and periods, which allows putting more structure into sentences and helps express meaning more clearly. I've been told that they're more commonly taught and used in Europe than the US, and my first language was Swedish. On the other hand I definitely write more code than otherwise, so that probably explains some of my fascination with punctuation. In the end, languages are tools for accurately conveying meaning; (see, there he goes) and whatever rules don't contribute to that goal may safely be tossed out.
- tytytytytytytyt 9y agoThe first semicolon doesn't appear to conform to any of the standard usages, nor does it seem to add any benefit over a normal comma. I thought the semicolon could replace a comma in a list of things, but you are using it to separate the intro clause? thing, like "In the end," above. > and whatever rules don't contribute to that goal may safely be tossed out Sure, but your usage here certainly isn't making things clearer.
- TheSpiceIsLife 9y agoI tend to use semicolons only when writing about a series where some or all items in the series contain a comma or commas, thusly: A semicolon has two general uses: to clarify a series and to indicate two closely related sentences. Series — If one or more elements in a series contain a comma, use semicolons to separate them. Include a semicolon before the final conjunction. (Members of the Western Jazz Quartet are Tom Knific, bassist; Trent Kynaston, saxophonist; Steve Zegree, pianist; and Tim Froncek, drummer.) Two closely related sentences — For the most part, you should use a semicolon only where you could also use a period, but want to demonstrate a relationship between two complete sentences. (Good grades are integral to student success; a strong support network is also important.) https://wmich.edu/writing/punctuation/colon https://wmich.edu/writing/punctuation/colon
- thinkpad20 9y agoSemicolons should be used to join two complete sentences while having a “comma-like” flow (e.g. “I like cake; it tastes good”). I personally tend to use them quite a lot (despite being American). However I generally don’t put more than one in a sentence, which I think is somewhat standard. That being said, I don’t think it’s considered an error, per se, to do so.
- nicolashahn 9y ago"decently typed"?
- sifoo 9y agoWell, from one angle it's statically typed; names never change their types within a scope. It's also strongly typed, more so than common scripting languages. On the other hand it has a very dynamic, gradual feel to it; to the point where you almost don't notice. That and the fact that using the word 'decent' seem to upset a lot of people, which is an indicator of much needed mental debugging.
- danbmil99 9y agoSweet, shades of FORTH. Very retro yet timely
- sifoo 9y agoThe principles of Forth sit at the bottom of most languages, though most like to keep that power to themselves. And I've always felt that the Forth language suffered from being so damn dogmatic and protective about the obvious lack of convenience. As an added bonus, it makes a nice contrast to the current trend of crippling languages ever more to protect people from themselves.
- davegauer 9y agoI 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...