Csound Csound-dev Csound-tekno Search About

[Csound] bug: can't use ternary operator with strings?

Date2015-10-17 19:49
FromKevin Welsh
Subject[Csound] bug: can't use ternary operator with strings?
I don't know if there's a logical reason it doesn't work, but I
noticed that I can't use a ternary operator with string variables...
for example, the first line does not work, and the second is a similar
example using both krate and constants which does work.

 Sbuf sprintfk "this %s work", ktest==1 ? "does" : "doesn't"
errors with:  unable to find ternary operator for types 'B ? S : S' line 19

Sbuf sprintfk "this %d works", ktest==1 ? ktest : 0

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

Date2015-10-17 20:12
FromKevin Welsh
SubjectRe: [Csound] bug: can't use ternary operator with strings?
Btw, I know to file it on git... just looking for some confirmation if
it should work first.

On Sat, Oct 17, 2015 at 2:49 PM, Kevin Welsh  wrote:
> I don't know if there's a logical reason it doesn't work, but I
> noticed that I can't use a ternary operator with string variables...
> for example, the first line does not work, and the second is a similar
> example using both krate and constants which does work.
>
>  Sbuf sprintfk "this %s work", ktest==1 ? "does" : "doesn't"
> errors with:  unable to find ternary operator for types 'B ? S : S' line 19
>
> Sbuf sprintfk "this %d works", ktest==1 ? ktest : 0

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

Date2015-10-17 20:17
Fromjpff
SubjectRe: [Csound] bug: can't use ternary operator with strings?
Looks to me that i soukd parse so the error is in the semantic/type 
checjing....humm


On Sat, 17 Oct 2015, Kevin Welsh wrote:

> Btw, I know to file it on git... just looking for some confirmation if
> it should work first.
>
> On Sat, Oct 17, 2015 at 2:49 PM, Kevin Welsh  wrote:
>> I don't know if there's a logical reason it doesn't work, but I
>> noticed that I can't use a ternary operator with string variables...
>> for example, the first line does not work, and the second is a similar
>> example using both krate and constants which does work.
>>
>>  Sbuf sprintfk "this %s work", ktest==1 ? "does" : "doesn't"
>> errors with:  unable to find ternary operator for types 'B ? S : S' line 19
>>
>> Sbuf sprintfk "this %d works", ktest==1 ? ktest : 0
>
> 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

Date2015-10-17 20:31
Fromjpff
SubjectRe: [Csound] bug: can't use ternary operator with strings?
Belieed fixed in git -- weakly tested


On Sat, 17 Oct 2015, Kevin Welsh wrote:

> Btw, I know to file it on git... just looking for some confirmation if
> it should work first.
>
> On Sat, Oct 17, 2015 at 2:49 PM, Kevin Welsh  wrote:
>> I don't know if there's a logical reason it doesn't work, but I
>> noticed that I can't use a ternary operator with string variables...
>> for example, the first line does not work, and the second is a similar
>> example using both krate and constants which does work.
>>
>>  Sbuf sprintfk "this %s work", ktest==1 ? "does" : "doesn't"
>> errors with:  unable to find ternary operator for types 'B ? S : S' line 19
>>
>> Sbuf sprintfk "this %d works", ktest==1 ? ktest : 0
>
> 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