Show HN: Silk, a simple systems programming language(ajaymt.github.io)
ajaymt.github.io
Show HN: Silk, a simple systems programming language
https://ajaymt.github.io/silk/
Hi HN! Silk is a project I began working on approximately six months ago without any prior experience or knowledge of compiler design, and it's been a frustrating but fun learning experience. It is very much a work in progress, but I would love to hear feedback of any kind!
18 comments
Congratulations, looks like a really nice language.
One nitpick: I think "val" looks too much like "var" and this will make it harder do differentiate them by code skimming. I suggest changing "val" to something like "const", or "fix", or "imm"...
One nitpick: I think "val" looks too much like "var" and this will make it harder do differentiate them by code skimming. I suggest changing "val" to something like "const", or "fix", or "imm"...
I find it interesting how there's so many ways now of describing mutable vs immutable.
Rust: let vs let mut Swift: let vs var Js: const vs let Silk: val vs var
I honestly get confused now. I started a new job working in go and I keep writing let everywhere
Rust: let vs let mut Swift: let vs var Js: const vs let Silk: val vs var
I honestly get confused now. I started a new job working in go and I keep writing let everywhere
The only one of those, that does not indicate by name to me, that it is about mutability, is the on of Swift. I guess you could argue, that in math, when someone says "let x be 2", then x is constant. In the context of programming though, I am more familiar with the var and let in JS, which is not at all about mutability.
Anecdote: Kotlin uses val/var, but IntelliJ (the de-facto standard editor for Kotlin) will underline all mutable variables.
If you don't mutate them after initialisation.
Never had this problem with Scala...
I really love the syntax, especially the dereference operator being the @ symbol and the usage of val vs var for constants/variables. (For context, I started off with Java and prefer writing in Kotlin nowadays.) Compared to languages like Zig or V, I think you strike a pretty good balance between being familiar and introducing new/different syntax.
Just curious: why might @ be preferred over &?
& isn't even the dereference operator, right? That's what gives you the pointer. * gives you the value at the pointer. I guess that's why it's preferable, in English it reads nicely and describes exactly what it does. `val arg = @(argv + 1)` reads like "val arg is the value at argv + 1"
I always read & as "at" mentally when reading code :)
I read it as "address of" but @ definitely works if we are talking about an address. The value is @x
whoops you are correct. interesting, thanks
As anecdote, my brain parses it more easily because I read "at", so I automatically interpret the expression as an address. Like "get the value at argv+1"
Nice work - also there is a slight name collision with the now-defunct Cilk family of programming languages https://en.wikipedia.org/wiki/Cilk
Would be nice to make the statement-ending semicolons optional. Like Swift, shell languages, JS (sorta), and more... I have moved to Swift from Obj-C, and this is one of my favorite things about Swift syntax.
I'm sorry to say I'm not the target audience for this (I've done a grand total of 7 paragraphs of K & R C, everything else is JIT or otherwise high level).
I will say it looks to have much nicer syntax than C without losing the ALGOL family feel.
Why have the type after the name if I might ask?
I will say it looks to have much nicer syntax than C without losing the ALGOL family feel.
Why have the type after the name if I might ask?
[deleted]