towerofnix / tlnccuwagnf

The Language Nobody Could Come Up With A Good Name For
MIT License
18 stars 3 forks source link

Unevaluated function parameters (syntax input wanted) #9

Closed towerofnix closed 8 years ago

towerofnix commented 8 years ago

Why? To make better control structures:

# old #
x => 2;
while(fn() { return(lt(x, 8)) }, fn() {
  x -> +(x, 1);
  print(x);
});

# new #
x => 2;
while(lt(x, 8), fn() {
  x -> +(x, 1);
  print(x);
});

How? I'm not sure. I can easily implement it but I'm not sure what the syntax should be -- all I can think of right now is this:

while => fn(unevaluated condition, loop) { #...# };

That's really big and clunky but clearer than something like this:

while => fn(%condition, loop) { #...# };

Any suggestions?

towerofnix commented 8 years ago

ping @BookOwl, @kvackkvack

You guys should all have followed this repository! >:D I need your help!

BookOwl commented 8 years ago

Sorry, I was offline for the past few hours. I assume that you wouldn't use this feature that much, so unevaluated name is fine. If you want something smaller, how about |name|?

towerofnix commented 8 years ago

Implemented with unevaluated name in https://github.com/liam4/tlnccuwagnf/commit/473ad48a74f57f3654b071ae53330909e74d1dcb. Still kind of open to suggestions but I think I'll stick with that.

plastpappa commented 8 years ago

I don't like using unevaluated like that since there aren't any other statements implemented. :package: I'd prefer |name| like @BookOwl suggests.

towerofnix commented 8 years ago

Maybe :name, or ..name? idk

since there aren't any other statements implemented.

You mean we don't have any other English words implemented (like var or change or whatever)? If so +1 :P

bates64 commented 8 years ago

how about noEval(...)? :package:

plastpappa commented 8 years ago

how about noEval(...)? :package:

ew no how would that work? :P to make it actually unevaluated then, you'd have to make unEval() a special case which makes its arguments unevaluated in the first place, and it'd all be very confusing.
I still like |name| the best. :P maybe noeval name, but it shouldn't be a function.

109C commented 8 years ago

How about '(lt(x, 8))?

towerofnix commented 8 years ago

How about '(lt(x, 8))?

Hold on, how does that work?

Keep in mind we're working on the syntax for unevaluated function parameters, i.e. what goes in the prototype/definition of the function:

this_is_a_fn => fn(insert unevaluated syntax here) {
  code code code
};
bates64 commented 8 years ago

I like |name|, then.

towerofnix commented 8 years ago

We're going with unevaluated arg-name.