These are chat archives for liam4/tlnccuwagnf

18th
Mar 2016
Florrie
@towerofnix
Mar 18 2016 00:49

It's a keyword.. in most programming languages.

Does it particularly matter if it's in a function? Besides, if it's a function, you can do something like this:

random_fn => fn(arr) {
  ret => return;
  # fake .each method #
  arr.each(fn(item) {
    if(some_condition_involving_item, fn() {
      ret(item);
    });
  });
};

You could also do this of course:

random_fn => fn(arr) {
  ret => 0; # no undefined for now, sorry #
  # fake .each method #
  arr.each(fn(item) {
    if(some_condition_involving_item, fn() {
      ret -> item;
    });
  });
  return(ret);
};

..but still, the former example skipped a step.

How does it really make any more sense for return to be a keyword?
109C
@109C
Mar 18 2016 00:50
Ask linus :P
Florrie
@towerofnix
Mar 18 2016 00:51
Linus is pretty busy right now, perhaps you could find him responding to the same question somewhere online? :P
109C
@109C
Mar 18 2016 00:51
How would multiple returns even work?
Florrie
@towerofnix
Mar 18 2016 00:52
The last return counts.
x => fn() {
  return(42);
  return(15);
};
x(); # 15 #
In terms of breaking a function.. not implemented yet :package:
109C
@109C
Mar 18 2016 00:52
That's kinda... surprising.
Florrie
@towerofnix
Mar 18 2016 00:53
What's so surprising about it? It's even less surprising if you take a look at the code that defines return
(I'll get you the link to the snippet)
Florrie
@towerofnix
Mar 18 2016 14:06

@/all

Decently big builtin update:

Added loop builtin! liam4/tlnccuwagnf@d42f37a

Example.

Added gt, lt, and eq comparison builtins! liam4/tlnccuwagnf@d6e54cf

Example.

Added not, or, and and boolean operator builtins! liam4/tlnccuwagnf@b84494d

Example.

Squashed big bugs!

  • return would return all it's parameters in an array instead of it's first parameter.
  • The -> change command wouldn't evaluate the new value, resulting in the old variable being set to the syntax tree for the given expression.