Hi Mike! This list is fantastic and extremely useful feedback. Thanks!
************************* 1. not all function calls are created equal
fun float myFunc0() { return 0.0; } fun float myFunc1(float x) { return 0.0; } fun float myFunc2(float x, float y) { return 0.0; }
0.0 => float x => float y => float z => float a;
() => myFunc0; // does not compile, () is not valid in this context x => myFunc1; // valid (x) => myFunc1; // valid (x, y) => myFunc2; // valid
This has been addressed. () is a value with type 'void' () => myFunc0; // should work in 1.2.0.5 (in CVS)
************************* 2. invalid cast to int from function
x => myFunc1 $ int => y; // does not compile (x => myFunc1) $ int => y; // does compile
************************* 3. cannot perform '-' on object references...
x => myFunc1 - z => a; // does not compile (x => myFunc1) - z => a; // does compile
These are due to operator precedence, and the current behavior is intended. => gets lower precedence in most cases to further accentuate the chucking of expressions. This will probably remain as is for now.
************************* 4. Library inconsistencies There are many functions in the 'std' library that would fit better (IMHO) in the 'math' library. Is there a particular reason why these functions are in 'std' and not 'math'? Could this be changed (without breaking the world of ChucK)? Any objections?
these functions will be duplicated in math in 1.2.0.5: .abs .fabs .sgn .rand .rand2 .rand2f .randf We will leave them in std as well to avoid backward compatibility issues. Thoughts on this? Any other functions to add to math?
************************* 5. doesn't work, but no compiler error
null @=> Object v; (v == null) ? true : false => int val; <<< v, val >>>; (v == null) ? false : true => val; <<< v, val >>>;
( exp ? exp1 : exp2 ) is now fully implemented and will be in 1.2.0.5.
************************* 6. Why would this compile, and not produce an error? What does ChucK do with it internally? Cause trouble? While this is a mistake, ChucKy eats it up like breakfast. I found this will testing something, and mistakenly entered 'public' instead of 'fun'. When I tried to use 'at()', ChucK said "undefined variable/member 'at' in class/namespace 'MyClass'..." 'at()' was defined outside of the class.
public float at(time n) { return n / 1::ms; }
The access modifiers don't do much right now. The error you got seems correct if at() was defined outside the class. Or am I misunderstanding this?
************************* 7. You can't use the "ChucK" form when sporking a shred...
fun void doit(float s) { }
(0.0) => spork ~ doit; // not valid spork ~ (0.0) => doit; // not valid spork ~ doit(0.0);
Hmm, interesting. We should discuss this more, as we want flexibility, but we should take care to keep things somewhat clear. The second line seems more reasonable than the first, and is consistent. We will leave this for the upcoming spork update to add and fix spork functionality. Thanks again! These are totally useful issues. Best, Ge!