Show HN: Nymph – A slightly different version of C
github.com
github.com
Why is there a readme link to download a .zip of the repo? I know how to clone.
Why is there a link to wikipedia's section on object orientation? I know that.
I don't understand the updates section. v3 parser implemented...okay? How is that better? What?
Then this big example which looks a lot like vanilla C. Is this the sum of what Nymph offers?
What I really want to know, and what is absent is:
* What does this give me that ordinary C doesn't?
* What are the longer-term goals of this project?
* Who is this intended for?
* How compatible will this be with ordinary C? Is there an interest in, say, gradual migration if this is to take off? What's the C <=> Nymph interop to look like?
- New users don't...
"Why is there a link to wikipedia's section on object orientation? I know that."
- Some people don't...
"What does this give me that ordinary C doesn't?"
- Simple Objects and function Overloading (it says this on the readme)
"What are the longer-term goals of this project?"
- Not entirely sure yet.
"Who is this intended for?"
- People who have interests in preprocessors and the C Language.
"How compatible will this be with ordinary C?"
- Very
Instead of OO I would like to know if we can do something about the (mostly compile performance) problem that importing external interfaces is done by including text files, and that compilation means writing intermediate results to disk.
Also there might or might not be a nice solution for better compile time code generation (just for the rare things where it's really useful, like support for type-generic value printing when debugging).
Jonathan Blow has made some really impressive advancements with his Jai language (his own language) compiler https://www.youtube.com/watch?v=gWv_vUgbmug. Compiling a game engine and a little game (50K lines of code I think) in less than a second. Whether his ideas work out well in the end or just work for himself remains to be shown, but it's very interesting to watch the video in any case.
Does malloc do something different? Explain in a comment.
What are the two different calls to `print()` supposed to demonstrate? How does nymph know which one to call?
In the `obj` block, there are initializers/default values, it seems. When are those set? How do they work?
Suggestions for the author:
Define the grammar in BNF and the semantics in prose.
Consider using a lexical scanner generator, a parser generator, and a string library.
Don't call strlen in a loop[1], many of your for loops are O(n^2) instead of O(n).
malloc returns uninitialized memory. Calling strcat on the return value of malloc[2] is a bug.
[0] https://news.ycombinator.com/item?id=15045592
[1] https://github.com/roecrew/nymph/blob/master/nymph/helper_fu...
[2] https://github.com/roecrew/nymph/blob/master/nymph/nymph_pp....
Edited to add the last two sentences.
Box **myBoxes = malloc(10*sizeof(Box));
Box *myBox = malloc(sizeof(Box));
myBoxes[0] = myBox;
looks like it should have used 10 times the size of a Box pointer.