Bend icon indicating copy to clipboard operation
Bend copied to clipboard

Questions regarding keywords

Open janroden opened this issue 1 year ago • 4 comments

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 fork function does exactly?
  • was curious why you decided to use object and type, instead of e.g. just struct and enum, like in Rust?

Bending is the opposite of folding. Whatever fold consumes, bend creates. 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 :)

janroden avatar May 18 '24 18:05 janroden

  • fork calls the function defined by bend recursively 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 object and type were good option.
  • bend could easily be called unfold, you're correct. Also, it's just my personal opinion, but if it were called unfold using bend for the recursive calls would be a bit strange. I'm not aware of previous uses of the keyword bend, 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.
  • u32 and u64 are 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.

developedby avatar May 18 '24 20:05 developedby

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?

janroden avatar May 18 '24 23:05 janroden

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.

Kesanov avatar May 20 '24 08:05 Kesanov

I'll leave this issue open as a task to improve the initial explanation of 'fork'

developedby avatar May 23 '24 18:05 developedby