6 ms·
I too have made a language! Hope you find Neat interesting. It's heavily inspired by D, except with reference counting instead of garbage collector. Also, it ha
by FeepingCreature 3y ago
I too have made a language! Hope you find Neat interesting. It's heavily inspired by D, except with reference counting instead of garbage collector. Also, it has macros.
My DConf talk on the language is now up too! https://www.youtube.com/watch?v=nDqlYnS-K2c https://www.youtube.com/watch?v=nDqlYnS-K2c
- jqpabc123 3y agoLooks fun ... and neat. But the mere fact that the primary ascribed goal is "fun" suggests it is not be taken seriously for actual work projects.
- FeepingCreature 3y agoOh no good god, Neat is definitely beta. This language has one user at the moment. Do not use it for actual work projects. (Though I will be proper chuffed if you do. I just can not recommend it.) To be honest, my goal is to have maybe 10 to 50 users right now. That'd be quite enough for this christmas.
- dr_kiszonka 3y agoRoR was optimized for developer happiness. Maybe a language optimized for fun could be used for serious work too? https://rubyonrails.org/doctrine https://rubyonrails.org/doctrine
- 7thaccount 3y agoThere's a few languages that claim to be optimized for fun (among other things). One example is Raku. I think -o Fun, is written somewhere.
- brabel 3y agoHaven't had the time to watch that talk yet... but what's your motivation to create a new language? Any drawbacks in D that you're trying to fix (besides the GC being replaced with RC - which many consider to also be GC by the way)?
- FeepingCreature 3y agoYep, here's the big ones: - proper macros - proper sumtypes with implicit conversion - more normal lambdas (seriously, D's lambdas are wild) - faster compiler with more caching and (maybe) eventually live reload? - proper packages instead of include path. And a bunch of small fry like format strings and named parameters. And yeah, um, GC can be good but the D GC kind of isn't. We use D at work, and we run into GC issues frequently. Neat's RC is a much thinner wrapper around C memory allocation, which is just better imo, much as GC and RC are logically equivalent in some ways.
- dataangel 3y agoFor the uninitiated what are wild about D lambdas? I'm familiar with C++ lambdas and Python lambdas.
- FeepingCreature 3y agoOkay so if you're calling a D std.algorithm function, for instance int factor = 2; assert([2, 3].map!(a => a * factor).array == [4, 6]); Then the `!` indicates that you're actually passing the lambda as a compiletime parameter to `map`. But the lambda can access the surrounding context! How does it pass a runtime value at compile time? So what you're passing is actually purely a function symbol. The way that it gets the stack reference to the surrounding function is that it's actually a nested function. And the way that `map` gets the stack reference to pass to the lambda is that, effectively, that instance of `map` is also a nested function of the calling function. That's also why you cannot pass a lambda as a template parameter to a class method in D: it already has a context parameter, ie. the class reference. In Neat, the value of the lambda is the stackframe reference, and it's just passed as a regular parameter: int factor = 2; assert([2, 3].map(a => a * factor).array == [4, 6]); Which avoids this whole issue at the cost of requiring some cleverness with refcounting.
- mhh__ 3y agoThis "Just pass it as a name" pattern has a been a complete disaster for D IMO. It was before my time but I think the explanation for why seems to be annoyingly along the lines of "dmd optimizer likes it". It also encourages people not to think about what the structure of their templates, so you can end up with truly massive amounts of duplication.
- logicprog 3y agoHey, I've been trying to not interact on social media much anymore but I just wanted to let you know that this looks like a pretty great (neat :)) little language! I'm very comfortable using Rust so I'm probably not going to end up using it, but my girlfriend is a data scientist who only knows Python and recently tried to start programming a game involving nbody simulation in Python, only to find that for the type of games she was trying to make Python was far too slow, and she's been really struggling to find a language that's relatively close to systems programming level (since she doesn't want to use an established engine) that also uses concepts and paradigms she understands and has reasonable syntax and stuff, and this looks like exactly what she's been looking for! When I sent her the link she got extremely excited, even more so when she saw that you had examples that were making games and using sdl. I hope you keep working on this language because I think it really does hit a nice (if niche) sweet spot! As a funny side note, I read the part on your website where you talk about why you chose reference counting over garbage collection, and despite your light-hearted resentment of the fact that garbage collection is such a turn off for people, the fact that your language doesn't use garbage collection is one of the major factors in why she might end up using it lol. We decided not to do C# (my first suggestion actually) because since she doesn't want to use an engine, it wouldn't be used just as a scripting language, but for the entire object model and update loop and so on, so GC would be a dealbreaker. Sorry- (tiny rant mode as a hobbyist gamedev myself) there is actually a good reason for this -- it is much easier to do multithreading when you don't have a separate thread going over all shared memory, and it's much easier to do a soft real time thing like game development if your memory allocation and deallocation stays relatively consistent and predictable, even if it is slower overall. Also, yes malloc may cause variable slowdowns too, but definitely to a smaller degree/varience than the average garbage collector and more predictably since you can control when allocations happen; otherwise there wouldn't be a noticeable difference between using garbage collected and non garbage collected languages for writing large-scale games. Plus, in any case, that's the reason why game developers tend to try to limit dynamic allocation at runtime in the first place.
- FeepingCreature 3y agoDid she find the built-in vector types yet? :) Small-scale gamedev is one place where I think this language could shine. Anyway, please also tell her to hit up the Discord (or IRC) for any questions!
- mhh__ 3y agoA pleasant surprise seeing it on the frontpage.
- FeepingCreature 3y agoYeah I think I'dve been crushed if this had ended up at like three upvotes, lol.
- AndruLuvisi 3y agoThank you for sharing! I didn't notice any mention of tail calls. Does it support proper tail calls?
- FeepingCreature 3y agoNot as an enforced thing. To be honest, I'm personally not too into recursion as a "must have" feature.