Questions regarding keywords
This looks like a really cool project!
I just read through the guide, and really liked the writing style :)
At a few points, I was curious, would love to learn more about:
- what the
forkfunction does exactly? - was curious why you decided to use
objectandtype, instead of e.g. juststructandenum, like in Rust?
Bending is the opposite of folding. Whatever
foldconsumes,bendcreates. The idea is that, by defining an initial state and a halting condition, we can "grow" a recursive structure, layer by layer, until the condition is met.
Here I was wondering why bend was chosen as a keyword? Given the above explanation, wouldn't something like spread, unfold, or grow be more intuitive then? Or are there other use cases not covered in the guide, where bend makes more sense as a keyword? Or is there some history from other languages?
case Shape/Circle:
Was curious why / was chosen for these kinds of namespaces / variants, instead of e.g. the :: like in Rust? Since normally / is used for division?
Bend comes with 3 built-in numeric types:
u24,i24,f24. That's quite small, we admit. Soon, we'll have larger types.
Is there already a plan for how other types, e.g. u32, will be indicated? Will there be something like Rust-like type annotations?
Thank you! I'm looking forward to where this project is going :)
-
forkcalls the function defined bybendrecursively passing the new state of the recursion. - We were trying to find good keywords that would be easily understandable by most developers. Bend is not in the exact same niche as any other programming language and attracts people of many different background, so we decided
objectandtypewere good option. -
bendcould easily be calledunfold, you're correct. Also, it's just my personal opinion, but if it were calledunfoldusingbendfor the recursive calls would be a bit strange. I'm not aware of previous uses of the keywordbend, but Taelin decided on that name and maybe had some inspirations I don't know about. - The
/is just a matter of preference. But also note that/is a normal name character that can be used however you want in function of variable names. If we used::that would be harder to do. -
u32andu64are planned and will be added as soon as HVM supports them. - A type system will be available with Kind. We'll probably make it a soft layer on top of Bend that you can opt-in/out of.
Thanks a lot for the detailed explanations! :-)
Maybe adding your explanation of fork to the guide, where it's first used, would make it a bit clearer?
I also vote for enum similar to rust enum. But prefer data instead of object similar to python and kotlin dataclass.
Object and Type are extremely abstract keywords that suggest nothing about actual functionality.
Even worse, type is also technically incorrect use of the term.
I'll leave this issue open as a task to improve the initial explanation of 'fork'