This is a list of something that I find to be a little difficult when learning ChucK. Language inconsistencies - I am point these things out, more from a 'linguistic' point of view, not so much as 'bugs'. One syntax about ChucK that I like is that data can come before the function calls that use that data. It just seems to make reading the code much easier. While this can be good for some things, others do suffer. One of those "troubles" is: 0.0 => myFunc; 0.0 => myFloat; it is hard to tell which one of these is really a function call, and which one is an assignment statement, without knowing the full program. And when you start to deal with objects, this might get to be trouble. When using Ugen objects, this is also kind of confusing, as when you are retrieving a value from the object, you use last() => myFloat; but when setting it, you use: myFloat => next; Now onto the specifics... ************************* 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 ************************* 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 ************************* 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? ************************* 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 >>>; ************************* 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; } ************************* 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); ************************* While some of these are important, I don't expect everything to be addressed. Thanks again to everyone who is working on this, it is wonderful, dispite my "complaints"... Mike
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!
(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.
Hmmmmm, in my opinion even the second line is confusing. The ChucK operater denotes action or singal flow and to me in the second line the "spork" word is what should be seen as the thing causing the action. If we want something like this I think it should be seen as a speciffic form of ChucKing, much like "@=>" or "+=>" and it would be more natural to have something along the lines of; (0.0) ~=> doit; Here it would be a new operator that like the others sends data to a target (in this case a new shred). That seems quite natural to me while the second option above has two bits that basically denote the same thing; data is being send. This seems needlessly verbose to me which would be a bad thing for live coding. Or I could be missing something, I din't quite considder this for as long as one should before one starts typing but then again that in itself seems quite ChucKian in a way.... :¬) Yours, Kas.
Chuck fans of the kitchen sink editor, I found an older copy of the ChucK emacs mode, but was getting errors with the execution stuff on emacs 21.3. The arguments to "call-process" weren't what my version of emacs expected, so I made some minor changes to make stuff work. I also added a menu item for "--removeall" and some irreverent code comments. a working copy may be found here: http://ravelite.org/code/chuck/chuck-mode.el hope it is useful, Graham
Hey, Thanks for this. Can we post it on the wiki? Also, can the author of the vim mode please stand up? I would like to see that on the wiki too. Thanks again. --art On 26-Feb-06, at 9:49 PM, Graham Coleman wrote:
Chuck fans of the kitchen sink editor,
I found an older copy of the ChucK emacs mode, but was getting errors with the execution stuff on emacs 21.3. The arguments to "call-process" weren't what my version of emacs expected, so I made some minor changes to make stuff work.
I also added a menu item for "--removeall" and some irreverent code comments.
a working copy may be found here: http://ravelite.org/code/chuck/chuck-mode.el
hope it is useful,
Graham
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
As far as this is a thin layer of changes on work by the previous author, Sure! I'll post any updates to the wiki as well. best, Graham On Sun, 26 Feb 2006, Adam Tindale wrote:
Hey,
Thanks for this. Can we post it on the wiki?
Also, can the author of the vim mode please stand up? I would like to see that on the wiki too.
Thanks again.
--art
On 26-Feb-06, at 9:49 PM, Graham Coleman wrote:
Chuck fans of the kitchen sink editor,
I found an older copy of the ChucK emacs mode, but was getting errors with the execution stuff on emacs 21.3. The arguments to "call-process" weren't what my version of emacs expected, so I made some minor changes to make stuff work.
I also added a menu item for "--removeall" and some irreverent code comments.
a working copy may be found here: http://ravelite.org/code/chuck/chuck-mode.el
hope it is useful,
Graham
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
Also, can the author of the vim mode please stand up? I would like to see that on the wiki too.
sure. I had some trouble when uploading. I uploaded: ck.vim -> got a warning saying .vim are not recommended chuck_syntax_highlight.tar -> got a warning for tar files chuck_syntax_highlight.tgz -> got a warning While I was getting warnings I thought the files were not uploaded. Sorry guys! The Tools page has been updated. So you can erase the last two an just keep ck.vim. Eduard
participants (6)
-
Adam Tindale
-
eduard
-
Ge Wang
-
Graham Coleman
-
Kassen Oud
-
Mike McGonagle