haumea-lang / haumea-rs

Haumea is an experimental language designed to be simple and easy to learn and program in.
MIT License
7 stars 2 forks source link

Events (change "main" procedure) #9

Closed bates64 closed 7 years ago

bates64 commented 7 years ago
to main do
    display(factorial(5))
end

Although main in C makes sense, here (since Haumea seems very english-like) it doesn't make much sense - perhaps

to begin do
to start do

could work better as a starting procedure?

jeandrek commented 7 years ago

Is there any advantage to requiring a "main" procedure at all?

BookOwl commented 7 years ago

It provides a natural place to put the starting code.

bates64 commented 7 years ago

It provides a natural place to put the starting code.

You could put the main procedure anywhere, no?

to main do /* it's at the top now! */
  this()
end

to this do
  display(25)
end

If you can support it, just make Haumea a scripting language (i.e. the main function is everything not within a procedure)!

TheMonsterFromTheDeep commented 7 years ago

Even if main is a block, it doesn't necessarily have to be a function. What about something like

on entry do
    display("Hello, world!")
end
BookOwl commented 7 years ago

How about this?

when started do
  display(1)
end
bates64 commented 7 years ago

"when" says 'event' to me. Could we add events to the standard library (async!)

BookOwl commented 7 years ago

When you think about it, the program starting is basically an event. As far as other events go, sure.

BookOwl commented 7 years ago

Moved to https://github.com/haumea-lang/thinktank/issues/3