That move it from a syntax issue to a semantics one and will work better with array access You doing it or should I try? ==John Quoting Steven Yi : > I think we could get a way with a simpler method, but looking at the > parse tree for opcode or function nodes. If it's "i", then check if > the argument is a single node or an expression, then issue a warning. > We could probably add that check during one of the other tree walk > phases and not use another phase. At least, in my head that'd work, > but I'm not positive. > > On Fri, Apr 4, 2014 at 9:42 AM, wrote: >> Would need to remove i from functions etc and lex it specially; think >> it is doable. But behind in e-mail >> >> Quoting Victor Lazzarini : >> >>> Agreed that is an easy mistake and it should be protected somehow, >>> but not sure how to tackle it >>> right now. It would need to be made an exception in the parser. >>> ======================== >>> Dr Victor Lazzarini >>> Senior Lecturer >>> NUI Maynooth, Ireland >>> victor dot lazzarini at nuim dot ie >>> >>> >>> >>> >>> On 4 Apr 2014, at 12:24, Oeyvind Brandtsegg >>> wrote: >>> >>>> I see, >>>> it is an easy mistake to make though. >>>> I see now that it is noted in the manual, >>>> but still, if one is not looking in the manual one could expect my >>>> original code to work. >>>> Could we make k-rate expressions illegal in this case, since it >>>> otherwise can lead to unexpected results. If the parser would stop and >>>> give an error message that k-rate expressions must be done outside the >>>> i(.), I think it would be very helpful. >>>> Oeyvind >>>> >>>> 2014-04-04 13:17 GMT+02:00 Victor Lazzarini : >>>>> it's because in i(.) the . has to be a variable (which is actually >>>>> a memory address). >>>>> ======================== >>>>> Dr Victor Lazzarini >>>>> Senior Lecturer >>>>> NUI Maynooth, Ireland >>>>> victor dot lazzarini at nuim dot ie >>>>> >>>>> >>>>> >>>>> >>>>> On 4 Apr 2014, at 10:24, Oeyvind Brandtsegg >>>>> wrote: >>>>> >>>>>> I wonder if this is a bug, >>>>>> I would expect i2 and i3 to be equal in the following example, >>>>>> but they are not. >>>>>> Almost as if i(kswitch+1) reads the *previous i-time value* of kswitch >>>>>> somehow (??) >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> sr = 44100 >>>>>> kr = 441 >>>>>> ksmps = 100 >>>>>> nchnls = 2 >>>>>> >>>>>> instr 1 >>>>>> >>>>>> kmetro metro 1 >>>>>> kswitch init 0 >>>>>> kswitch = (kswitch+kmetro)%2 >>>>>> printk2 kswitch >>>>>> if kmetro > 0 then >>>>>> reinit testme >>>>>> endif >>>>>> >>>>>> testme: >>>>>> i1 = i(kswitch) >>>>>> i2 = i(kswitch+1) >>>>>> i3 = i1+1 >>>>>> print i1, i2, i3 >>>>>> rireturn >>>>>> >>>>>> endin >>>>>> >>>>>> >>>>>> i1 0 5 >>>>>> e >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> >>>>>> Oeyvind Brandtsegg >>>>>> Professor of Music Technology >>>>>> NTNU >>>>>> 7491 Trondheim >>>>>> Norway >>>>>> Cell: +47 92 203 205 >>>>>> >>>>>> http://flyndresang.no/ >>>>>> http://www.partikkelaudio.com/ >>>>>> http://soundcloud.com/brandtsegg >>>>>> http://soundcloud.com/t-emp >>>>>> >>>>>> ------------------------------------------------------------------------------ >>>>>> _______________________________________________ >>>>>> Csound-devel mailing list >>>>>> Csound-devel@lists.sourceforge.net >>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel >>>>> >>>>> >>>>> ------------------------------------------------------------------------------ >>>>> _______________________________________________ >>>>> Csound-devel mailing list >>>>> Csound-devel@lists.sourceforge.net >>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel >>>> >>>> >>>> >>>> -- >>>> >>>> Oeyvind Brandtsegg >>>> Professor of Music Technology >>>> NTNU >>>> 7491 Trondheim >>>> Norway >>>> Cell: +47 92 203 205 >>>> >>>> http://flyndresang.no/ >>>> http://www.partikkelaudio.com/ >>>> http://soundcloud.com/brandtsegg >>>> http://soundcloud.com/t-emp >>>> >>>> ------------------------------------------------------------------------------ >>>> _______________________________________________ >>>> Csound-devel mailing list >>>> Csound-devel@lists.sourceforge.net >>>> https://lists.sourceforge.net/lists/listinfo/csound-devel >>> >>> >>> ------------------------------------------------------------------------------ >>> _______________________________________________ >>> Csound-devel mailing list >>> Csound-devel@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/csound-devel >> >> >> >> >> ------------------------------------------------------------------------------ >> _______________________________________________ >> Csound-devel mailing list >> Csound-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/csound-devel > > ------------------------------------------------------------------------------ > _______________________________________________ > Csound-devel mailing list > Csound-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/csound-devel ------------------------------------------------------------------------------ _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net