Kas,

1 => foo;

this is sane, but this isn't:

1 => foo => bar;

foo(1) is the same as 1 => foo

foo => bar is the same as bar(foo)

however, I was suggesting that I could assign the object/function foo to reference bar this way:

foo @=> bar;

which means this:

1 => bar;

would now return 3 because bar is now a reference to the same function foo is a reference to.

see what I mean?



additionally, given

fun fun int bing(int b)
{
   fun void funk(int i) { return b+i; }
   return funk;
}

this:

<<< 4 => bing(5) >>>;

should print "9" in my weird world.  I'm not sure that this actually is going to work this way, i'm just suggesting that we could get a lot of interesting things if functions were objects.  I might be lynched for saying this, but JavaScript works this way.  It's a lot easier with a dynamically typed language in which variables are always just references to other things (like they are in Chuck with objects, but not with primitives).

I don't think we're going to get away with this without adding some sort of keyword to Chuck.  "function" is already taken as a keyword, according to the documentation, even though nothing using it has been implemented as far as I know.  Perhaps we can add a function type that extends object. 

-Mike


2010/1/6 Kassen <signal.automatique@gmail.com>
Mike;

What about this:


Well;

fun int foo( int arg)
  {
  return 3;
  } 

fun void bar( int arg)
  {
  <<<"boring">>>;
  }

//overload
fun void bar ( fun arg)
  {
  <<<"fun">>>;
  }

1 => foo => bar;

Would that print "fun" or "boring"? That last line is a case where we refer to the function without parentheses yet still expect it to be called and to return under current syntax.

Yours,
Kas.

_______________________________________________
chuck-users mailing list
chuck-users@lists.cs.princeton.edu
https://lists.cs.princeton.edu/mailman/listinfo/chuck-users




--
http://michaelclemow.com
http://semiotech.org