Pike v7.6 release 7 running Hilfe v3.5 (Incremental Pike Frontend)
int year=2004; int month=12; int day=2; object oday = Calendar.Year(year)->month(month)->day(day);
Compiler Error: 1:syntax error, unexpected '(' Compiler Error: 1:syntax error, unexpected '('
??? can anyone explain this?
greetings, martin.
Hilfe rewrites your expression to the program
mapping(string:mixed) ___hilfe = ___Hilfe->variables; object oday = Calendar.Year((([mapping(string:int)]___hilfe)->year))->(([mapping(string:int)]___hilfe)->month)((([mapping(string:int)]___hilfe)->month))->(([mapping(string:int)]___hilfe)->day)((([mapping(string:int)]___hilfe)->day)); mixed ___HilfeWrapper() { return oday; }
As you can see, it has mistakenly interpreted the method names "month" and "day" as referring to your Hilfe variables "month" and "day", and thus done an incorrect substitution. (Hilfe variables are actually entries in the mapping ___Hilfe->variables, so references to them need to be replaced before compiling the expression.)
"dump wrapper" is a useful Hilfe command.
And yes, this is a bug. Hilfe should not substitute identifiers that appear after "->" or ".".
Ugh, when did this happen? Hilfe should make actual global variables so that this kind of crap doesn't happen, am I completely insane if I think that this didn't use to be a problem?
My bet is on this change:
---------------------------- revision 1.47 date: 2002/03/21 00:29:21; author: nilsson; state: Exp; lines: +90 -25 Added yet another level of complexity. The input expression is now analyzed from a variable scope point of view and variables refering to global variables are rewritten so that they work properly for strings, floats and ints. Not only does this fix [bug 2846], but it will also introduce quite a lot of other bugs. I sus pect so anyway. ----------------------------
:-)
It's a good, honest comment. Half a step in the right direction, maybe a few back as well. Won't have people assume what you did wrong was an intentional design.
pike-devel@lists.lysator.liu.se