Csound Csound-dev Csound-tekno Search About

[Csnd] array size question

Date2019-03-25 12:30
FromEduardo Moguillansky
Subject[Csnd] array size question
What would you expect the first printf to be?

    kA[] fillarray 0, 1, 2, 3, 4, 5
    printarray kA, 1
    printf "kSize 1 = %d \n", 1, lenarray:k(kA)

    kB[] fillarray 0, 1, 2, 3
    kA = kB * 2
    printarray kA, 1
    printf "kSize 2 = %d \n", 1, lenarray:k(kA)
    turnoff

I would have assumed that it would print 6, but it prints 4. What 
actually seems to happen right now is that the assignment kA = kB * 2 
has an init-time function which ensures the size of kA to be the size 
of kB **at init time**, which makes the size of kA to be wrong for the 
first printf. I personally think that this i-time behaviour should be 
removed and checks should be made at each k-pass. At the very least, 
this should be an error. What do you think?

best
eduardo

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2019-03-25 12:35
Fromjohn
SubjectRe: [Csnd] array size question
There was an explicit request for the current behaviour so this would need 
a major discussion.

On Mon, 25 Mar 2019, Eduardo Moguillansky wrote:

> What would you expect the first printf to be?
>
>   kA[] fillarray 0, 1, 2, 3, 4, 5
>   printarray kA, 1
>   printf "kSize 1 = %d \n", 1, lenarray:k(kA)
>
>   kB[] fillarray 0, 1, 2, 3
>   kA = kB * 2
>   printarray kA, 1
>   printf "kSize 2 = %d \n", 1, lenarray:k(kA)
>   turnoff
>
> I would have assumed that it would print 6, but it prints 4. What actually 
> seems to happen right now is that the assignment kA = kB * 2 has an init-time 
> function which ensures the size of kA to be the size of kB **at init time**, 
> which makes the size of kA to be wrong for the first printf. I personally 
> think that this i-time behaviour should be removed and checks should be made 
> at each k-pass. At the very least, this should be an error. What do you 
> think?
>
> best
> eduardo
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>       https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
>

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2019-03-26 09:18
FromEduardo Moguillansky
SubjectRe: [Csnd] array size question
To be clear on this issue, I am not saying that the assignment "kA = kB 
* 2" should not change the perceived size of the array, but that this 
change happens at init time, so that any k-time operation on the array 
is performed on the wrong size. In my opinion the correct and expected 
behaviour is to call tabensure at every k-pass, only resizing upwards 
if necessary. In this way, the array would have the expected behaviour 
for the first printf and still be correct for the second.

On Mo, Mar 25, 2019 at 1:35 PM, john  wrote:
> There was an explicit request for the current behaviour so this would 
> need a major discussion.
> 
> On Mon, 25 Mar 2019, Eduardo Moguillansky wrote:
> 
>> What would you expect the first printf to be?
>> 
>>   kA[] fillarray 0, 1, 2, 3, 4, 5
>>   printarray kA, 1
>>   printf "kSize 1 = %d \n", 1, lenarray:k(kA)
>> 
>>   kB[] fillarray 0, 1, 2, 3
>>   kA = kB * 2
>>   printarray kA, 1
>>   printf "kSize 2 = %d \n", 1, lenarray:k(kA)
>>   turnoff
>> 
>> I would have assumed that it would print 6, but it prints 4. What 
>> actually seems to happen right now is that the assignment kA = kB * 
>> 2 has an init-time function which ensures the size of kA to be the 
>> size of kB **at init time**, which makes the size of kA to be wrong 
>> for the first printf. I personally think that this i-time behaviour 
>> should be removed and checks should be made at each k-pass. At the 
>> very least, this should be an error. What do you think?
>> 
>> best
>> eduardo
>> 
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>       https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>> 
> 
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2019-03-26 10:40
FromRory Walsh
SubjectRe: [Csnd] array size question
if necessary. In this way, the array would have the expected behaviour
for the first printf and still be correct for the second.

I think this is what most user would expect? I certainly failed to answer the first question Eduardo posed. @Joachim Heintz what are your thoughts on this? 


 

On Mo, Mar 25, 2019 at 1:35 PM, john <jpff@CODEMIST.CO.UK> wrote:
> There was an explicit request for the current behaviour so this would
> need a major discussion.
>
> On Mon, 25 Mar 2019, Eduardo Moguillansky wrote:
>
>> What would you expect the first printf to be?
>>
>>   kA[] fillarray 0, 1, 2, 3, 4, 5
>>   printarray kA, 1
>>   printf "kSize 1 = %d \n", 1, lenarray:k(kA)
>>
>>   kB[] fillarray 0, 1, 2, 3
>>   kA = kB * 2
>>   printarray kA, 1
>>   printf "kSize 2 = %d \n", 1, lenarray:k(kA)
>>   turnoff
>>
>> I would have assumed that it would print 6, but it prints 4. What
>> actually  seems to happen right now is that the assignment kA = kB *
>> 2 has an init-time  function which ensures the size of kA to be the
>> size of kB **at init time**,  which makes the size of kA to be wrong
>> for the first printf. I personally  think that this i-time behaviour
>> should be removed and checks should be made  at each k-pass. At the
>> very least, this should be an error. What do you  think?
>>
>> best
>> eduardo
>>
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>       https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>>
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2019-03-26 22:02
Fromjoachim heintz
SubjectRe: [Csnd] array size question
as far as i understand, it is the ambiguity of the = operator (whether 
it refers to i- or k-rate) which makes things complcated here.

for strings, we have strcpy and strcpyk to distinguish.  perhaps we need 
something similar here?



On 26/03/19 11:40, Rory Walsh wrote:
>     if necessary. In this way, the array would have the expected behaviour
>     for the first printf and still be correct for the second.
>
>
> I think this is what most user would expect? I certainly failed to
> answer the first question Eduardo posed. @Joachim Heintz
>  what are your thoughts on this?
>
>
>
>
>
>     On Mo, Mar 25, 2019 at 1:35 PM, john      > wrote:
>     > There was an explicit request for the current behaviour so this would
>     > need a major discussion.
>     >
>     > On Mon, 25 Mar 2019, Eduardo Moguillansky wrote:
>     >
>     >> What would you expect the first printf to be?
>     >>
>     >>   kA[] fillarray 0, 1, 2, 3, 4, 5
>     >>   printarray kA, 1
>     >>   printf "kSize 1 = %d \n", 1, lenarray:k(kA)
>     >>
>     >>   kB[] fillarray 0, 1, 2, 3
>     >>   kA = kB * 2
>     >>   printarray kA, 1
>     >>   printf "kSize 2 = %d \n", 1, lenarray:k(kA)
>     >>   turnoff
>     >>
>     >> I would have assumed that it would print 6, but it prints 4. What
>     >> actually  seems to happen right now is that the assignment kA = kB *
>     >> 2 has an init-time  function which ensures the size of kA to be the
>     >> size of kB **at init time**,  which makes the size of kA to be wrong
>     >> for the first printf. I personally  think that this i-time behaviour
>     >> should be removed and checks should be made  at each k-pass. At the
>     >> very least, this should be an error. What do you  think?
>     >>
>     >> best
>     >> eduardo
>     >>
>     >> Csound mailing list
>     >> Csound@listserv.heanet.ie 
>     >> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>     >> Send bugs reports to
>     >>       https://github.com/csound/csound/issues
>     >> Discussions of bugs and features can be posted here
>     >>
>     >
>     > Csound mailing list
>     > Csound@listserv.heanet.ie 
>     > https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>     > Send bugs reports to
>     >        https://github.com/csound/csound/issues
>     > Discussions of bugs and features can be posted here
>
>     Csound mailing list
>     Csound@listserv.heanet.ie 
>     https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>     Send bugs reports to
>             https://github.com/csound/csound/issues
>     Discussions of bugs and features can be posted here
>
> Csound mailing list Csound@listserv.heanet.ie
> 
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
> https://github.com/csound/csound/issues Discussions of bugs and features
> can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2019-03-26 22:15
FromEduardo Moguillansky
SubjectRe: [Csnd] array size question
In this case there is no ambiguity, since k[] * constant could never be 
an i-rate operation. But since it was mentioned that the current 
behaviour was explicitely asked for, could someone point to a case 
where this behaviour is the desired and expected one?

On Di, Mar 26, 2019 at 11:02 PM, joachim heintz  
wrote:
> as far as i understand, it is the ambiguity of the = operator 
> (whether it refers to i- or k-rate) which makes things complcated 
> here.
> 
> for strings, we have strcpy and strcpyk to distinguish.  perhaps we 
> need something similar here?
> 
> 
> 
> On 26/03/19 11:40, Rory Walsh wrote:
>>     if necessary. In this way, the array would have the expected 
>> behaviour
>>     for the first printf and still be correct for the second.
>> 
>> 
>> I think this is what most user would expect? I certainly failed to
>> answer the first question Eduardo posed. @Joachim Heintz
>>  what are your thoughts on this?
>> 
>> 
>> 
>> 
>> 
>>     On Mo, Mar 25, 2019 at 1:35 PM, john >     > wrote:
>>     > There was an explicit request for the current behaviour so 
>> this would
>>     > need a major discussion.
>>     >
>>     > On Mon, 25 Mar 2019, Eduardo Moguillansky wrote:
>>     >
>>     >> What would you expect the first printf to be?
>>     >>
>>     >>   kA[] fillarray 0, 1, 2, 3, 4, 5
>>     >>   printarray kA, 1
>>     >>   printf "kSize 1 = %d \n", 1, lenarray:k(kA)
>>     >>
>>     >>   kB[] fillarray 0, 1, 2, 3
>>     >>   kA = kB * 2
>>     >>   printarray kA, 1
>>     >>   printf "kSize 2 = %d \n", 1, lenarray:k(kA)
>>     >>   turnoff
>>     >>
>>     >> I would have assumed that it would print 6, but it prints 4. 
>> What
>>     >> actually  seems to happen right now is that the assignment kA 
>> = kB *
>>     >> 2 has an init-time  function which ensures the size of kA to 
>> be the
>>     >> size of kB **at init time**,  which makes the size of kA to 
>> be wrong
>>     >> for the first printf. I personally  think that this i-time 
>> behaviour
>>     >> should be removed and checks should be made  at each k-pass. 
>> At the
>>     >> very least, this should be an error. What do you  think?
>>     >>
>>     >> best
>>     >> eduardo
>>     >>
>>     >> Csound mailing list
>>     >> Csound@listserv.heanet.ie 
>>     >> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>     >> Send bugs reports to
>>     >>       https://github.com/csound/csound/issues
>>     >> Discussions of bugs and features can be posted here
>>     >>
>>     >
>>     > Csound mailing list
>>     > Csound@listserv.heanet.ie 
>>     > https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>     > Send bugs reports to
>>     >        https://github.com/csound/csound/issues
>>     > Discussions of bugs and features can be posted here
>> 
>>     Csound mailing list
>>     Csound@listserv.heanet.ie 
>>     https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>     Send bugs reports to
>>             https://github.com/csound/csound/issues
>>     Discussions of bugs and features can be posted here
>> 
>> Csound mailing list Csound@listserv.heanet.ie
>> 
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
>> https://github.com/csound/csound/issues Discussions of bugs and 
>> features
>> can be posted here
> 
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2019-03-27 09:59
Fromjoachim heintz
SubjectRe: [Csnd] array size question
i am not that deep in it but perhaps john was referring to this:
https://github.com/csound/csound/issues/1039



On 26/03/19 23:15, Eduardo Moguillansky wrote:
> In this case there is no ambiguity, since k[] * constant could never be
> an i-rate operation. But since it was mentioned that the current
> behaviour was explicitely asked for, could someone point to a case where
> this behaviour is the desired and expected one?
>
> On Di, Mar 26, 2019 at 11:02 PM, joachim heintz 
> wrote:
>> as far as i understand, it is the ambiguity of the = operator (whether
>> it refers to i- or k-rate) which makes things complcated here.
>>
>> for strings, we have strcpy and strcpyk to distinguish.  perhaps we
>> need something similar here?
>>
>>
>>
>> On 26/03/19 11:40, Rory Walsh wrote:
>>>     if necessary. In this way, the array would have the expected
>>> behaviour
>>>     for the first printf and still be correct for the second.
>>>
>>>
>>> I think this is what most user would expect? I certainly failed to
>>> answer the first question Eduardo posed. @Joachim Heintz
>>>  what are your thoughts on this?
>>>
>>>
>>>
>>>
>>>
>>>     On Mo, Mar 25, 2019 at 1:35 PM, john >>     > wrote:
>>>     > There was an explicit request for the current behaviour so this
>>> would
>>>     > need a major discussion.
>>>     >
>>>     > On Mon, 25 Mar 2019, Eduardo Moguillansky wrote:
>>>     >
>>>     >> What would you expect the first printf to be?
>>>     >>
>>>     >>   kA[] fillarray 0, 1, 2, 3, 4, 5
>>>     >>   printarray kA, 1
>>>     >>   printf "kSize 1 = %d \n", 1, lenarray:k(kA)
>>>     >>
>>>     >>   kB[] fillarray 0, 1, 2, 3
>>>     >>   kA = kB * 2
>>>     >>   printarray kA, 1
>>>     >>   printf "kSize 2 = %d \n", 1, lenarray:k(kA)
>>>     >>   turnoff
>>>     >>
>>>     >> I would have assumed that it would print 6, but it prints 4. What
>>>     >> actually  seems to happen right now is that the assignment kA
>>> = kB *
>>>     >> 2 has an init-time  function which ensures the size of kA to
>>> be the
>>>     >> size of kB **at init time**,  which makes the size of kA to be
>>> wrong
>>>     >> for the first printf. I personally  think that this i-time
>>> behaviour
>>>     >> should be removed and checks should be made  at each k-pass.
>>> At the
>>>     >> very least, this should be an error. What do you  think?
>>>     >>
>>>     >> best
>>>     >> eduardo
>>>     >>
>>>     >> Csound mailing list
>>>     >> Csound@listserv.heanet.ie 
>>>     >> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>     >> Send bugs reports to
>>>     >>       https://github.com/csound/csound/issues
>>>     >> Discussions of bugs and features can be posted here
>>>     >>
>>>     >
>>>     > Csound mailing list
>>>     > Csound@listserv.heanet.ie 
>>>     > https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>     > Send bugs reports to
>>>     >        https://github.com/csound/csound/issues
>>>     > Discussions of bugs and features can be posted here
>>>
>>>     Csound mailing list
>>>     Csound@listserv.heanet.ie 
>>>     https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>     Send bugs reports to
>>>             https://github.com/csound/csound/issues
>>>     Discussions of bugs and features can be posted here
>>>
>>> Csound mailing list Csound@listserv.heanet.ie
>>> 
>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
>>> https://github.com/csound/csound/issues Discussions of bugs and features
>>> can be posted here
>>
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>        https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
>

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2019-03-27 10:30
FromEduardo Moguillansky
SubjectRe: [Csnd] array size question
That is a very long discussion... But what I inderstood from skimming 
through it is that the critique was actually the same as here: an array 
action that is supposed to act at k-rate has an init component which 
collides with other init components (presumably to avoid having to do 
allocations at each k-pass). But since an array has an allocated and an 
apparent size, leaving the init part out would solve this and the 
situation mentioned in that discussion. At each k-pass the array's 
apparent size would be set to the needed size, growing it if necessary.

On Mi, Mar 27, 2019 at 10:59 AM, joachim heintz  
wrote:
> i am not that deep in it but perhaps john was referring to this:
> https://github.com/csound/csound/issues/1039
> 
> 
> 
> On 26/03/19 23:15, Eduardo Moguillansky wrote:
>> In this case there is no ambiguity, since k[] * constant could never 
>> be
>> an i-rate operation. But since it was mentioned that the current
>> behaviour was explicitely asked for, could someone point to a case 
>> where
>> this behaviour is the desired and expected one?
>> 
>> On Di, Mar 26, 2019 at 11:02 PM, joachim heintz 
>> wrote:
>>> as far as i understand, it is the ambiguity of the = operator 
>>> (whether
>>> it refers to i- or k-rate) which makes things complcated here.
>>> 
>>> for strings, we have strcpy and strcpyk to distinguish.  perhaps we
>>> need something similar here?
>>> 
>>> 
>>> 
>>> On 26/03/19 11:40, Rory Walsh wrote:
>>>>     if necessary. In this way, the array would have the expected
>>>> behaviour
>>>>     for the first printf and still be correct for the second.
>>>> 
>>>> 
>>>> I think this is what most user would expect? I certainly failed to
>>>> answer the first question Eduardo posed. @Joachim Heintz
>>>>  what are your thoughts on this?
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>>     On Mo, Mar 25, 2019 at 1:35 PM, john >>>     > wrote:
>>>>     > There was an explicit request for the current behaviour so 
>>>> this
>>>> would
>>>>     > need a major discussion.
>>>>     >
>>>>     > On Mon, 25 Mar 2019, Eduardo Moguillansky wrote:
>>>>     >
>>>>     >> What would you expect the first printf to be?
>>>>     >>
>>>>     >>   kA[] fillarray 0, 1, 2, 3, 4, 5
>>>>     >>   printarray kA, 1
>>>>     >>   printf "kSize 1 = %d \n", 1, lenarray:k(kA)
>>>>     >>
>>>>     >>   kB[] fillarray 0, 1, 2, 3
>>>>     >>   kA = kB * 2
>>>>     >>   printarray kA, 1
>>>>     >>   printf "kSize 2 = %d \n", 1, lenarray:k(kA)
>>>>     >>   turnoff
>>>>     >>
>>>>     >> I would have assumed that it would print 6, but it prints 
>>>> 4. What
>>>>     >> actually  seems to happen right now is that the assignment 
>>>> kA
>>>> = kB *
>>>>     >> 2 has an init-time  function which ensures the size of kA to
>>>> be the
>>>>     >> size of kB **at init time**,  which makes the size of kA to 
>>>> be
>>>> wrong
>>>>     >> for the first printf. I personally  think that this i-time
>>>> behaviour
>>>>     >> should be removed and checks should be made  at each k-pass.
>>>> At the
>>>>     >> very least, this should be an error. What do you  think?
>>>>     >>
>>>>     >> best
>>>>     >> eduardo
>>>>     >>
>>>>     >> Csound mailing list
>>>>     >> Csound@listserv.heanet.ie 
>>>>     >> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>>     >> Send bugs reports to
>>>>     >>       https://github.com/csound/csound/issues
>>>>     >> Discussions of bugs and features can be posted here
>>>>     >>
>>>>     >
>>>>     > Csound mailing list
>>>>     > Csound@listserv.heanet.ie 
>>>>     > https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>>     > Send bugs reports to
>>>>     >        https://github.com/csound/csound/issues
>>>>     > Discussions of bugs and features can be posted here
>>>> 
>>>>     Csound mailing list
>>>>     Csound@listserv.heanet.ie 
>>>>     https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>>     Send bugs reports to
>>>>             https://github.com/csound/csound/issues
>>>>     Discussions of bugs and features can be posted here
>>>> 
>>>> Csound mailing list Csound@listserv.heanet.ie
>>>> 
>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports 
>>>> to
>>>> https://github.com/csound/csound/issues Discussions of bugs and 
>>>> features
>>>> can be posted here
>>> 
>>> Csound mailing list
>>> Csound@listserv.heanet.ie
>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>> Send bugs reports to
>>>        https://github.com/csound/csound/issues
>>> Discussions of bugs and features can be posted here
>> 
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>        https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>> 
> 
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2019-03-27 17:50
FromMauro Giubileo
SubjectRe: [Csnd] array size question

I'm the user who opened that issue on github and it was solved by making slicearray:k[] work only at k-time.
Yes, it appears to be a similar problem...

In your example, the user expects that an array assignment operation with a k-array output would run only at k-time, so it's very confusing that something like "kA = kB" can change the kA array size at i-time too. Let's consider this:

    kA[]    fillarray   0, 1, 2, 3, 4, 5    ; i-time
            printk      0, lenarray:k(kA)   ; k-time
        
    kB[]    fillarray   0, 1, 2, 3          ; i-time
    kA      =           kB                  ; i-time (UNEXPECTED!) AND k-time
            printk      0, lenarray:k(kA)   ; k-time
            turnoff

The printed results will be 4 for both the printk (instead of 6 and 4) because the "kA = kB" unexpectedly runs at i-time too...

I don't know how it's implemented the "=" operation in csound, but maybe in this case too it could be solved by running the assignment opcode for k-rate output arrays only at k-time.

Regards,

---
Mauro

 


Il 2019-03-27 11:30 Eduardo Moguillansky ha scritto:

That is a very long discussion... But what I inderstood from skimming through it is that the critique was actually the same as here: an array action that is supposed to act at k-rate has an init component which collides with other init components (presumably to avoid having to do allocations at each k-pass). But since an array has an allocated and an apparent size, leaving the init part out would solve this and the situation mentioned in that discussion. At each k-pass the array's apparent size would be set to the needed size, growing it if necessary.

On Mi, Mar 27, 2019 at 10:59 AM, joachim heintz <jh@JOACHIMHEINTZ.DE> wrote:
i am not that deep in it but perhaps john was referring to this:
https://github.com/csound/csound/issues/1039



On 26/03/19 23:15, Eduardo Moguillansky wrote:
In this case there is no ambiguity, since k[] * constant could never be
an i-rate operation. But since it was mentioned that the current
behaviour was explicitely asked for, could someone point to a case where
this behaviour is the desired and expected one?

On Di, Mar 26, 2019 at 11:02 PM, joachim heintz <jh@JOACHIMHEINTZ.DE>
wrote:
as far as i understand, it is the ambiguity of the = operator (whether
it refers to i- or k-rate) which makes things complcated here.

for strings, we have strcpy and strcpyk to distinguish.  perhaps we
need something similar here?



On 26/03/19 11:40, Rory Walsh wrote:
    if necessary. In this way, the array would have the expected
behaviour
    for the first printf and still be correct for the second.


I think this is what most user would expect? I certainly failed to
answer the first question Eduardo posed. @Joachim Heintz
<mailto:jh@joachimheintz.de> what are your thoughts on this?





    On Mo, Mar 25, 2019 at 1:35 PM, john <jpff@CODEMIST.CO.UK
    <mailto:jpff@CODEMIST.CO.UK>> wrote:
    > There was an explicit request for the current behaviour so this
would
    > need a major discussion.
    >
    > On Mon, 25 Mar 2019, Eduardo Moguillansky wrote:
    >
    >> What would you expect the first printf to be?
    >>
    >>   kA[] fillarray 0, 1, 2, 3, 4, 5
    >>   printarray kA, 1
    >>   printf "kSize 1 = %d \n", 1, lenarray:k(kA)
    >>
    >>   kB[] fillarray 0, 1, 2, 3
    >>   kA = kB * 2
    >>   printarray kA, 1
    >>   printf "kSize 2 = %d \n", 1, lenarray:k(kA)
    >>   turnoff
    >>
    >> I would have assumed that it would print 6, but it prints 4. What
    >> actually  seems to happen right now is that the assignment kA
= kB *
    >> 2 has an init-time  function which ensures the size of kA to
be the
    >> size of kB **at init time**,  which makes the size of kA to be
wrong
    >> for the first printf. I personally  think that this i-time
behaviour
    >> should be removed and checks should be made  at each k-pass.
At the
    >> very least, this should be an error. What do you  think?
    >>
    >> best
    >> eduardo
    >>
    >> Csound mailing list
    >> Csound@listserv.heanet.ie <mailto:Csound@listserv.heanet.ie>
    >> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
    >> Send bugs reports to
    >>       https://github.com/csound/csound/issues
    >> Discussions of bugs and features can be posted here
    >>
    >
    > Csound mailing list
    > Csound@listserv.heanet.ie <mailto:Csound@listserv.heanet.ie>
    > https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
    > Send bugs reports to
    >        https://github.com/csound/csound/issues
    > Discussions of bugs and features can be posted here

    Csound mailing list
    Csound@listserv.heanet.ie <mailto:Csound@listserv.heanet.ie>
    https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
    Send bugs reports to
            https://github.com/csound/csound/issues
    Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie
<mailto:Csound@listserv.heanet.ie>
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
https://github.com/csound/csound/issues Discussions of bugs and features
can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
       https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
       https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
       https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
       https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here