Re: [Csnd-dev] [EXTERNAL] [Csnd-dev] default arguments for UDOs in new syntax

Victor Lazzarini <[email protected]>
Newsgroups gmane.comp.audio.csound.devel
Message-ID <[email protected]>
This fix is just to bring newstyle UDOs to the same level of functionality as the original form. I did not touch the parser per se, just adjusted the semantic analysis to accept and translate optional types into i or k, as needed.

To get a syntax like

opcode myop(var:i=5)

we need to insert a rule in the parser to look for that pattern, then add code in the semantic analysis to understand it, and then adapt the UDO inargs reading to understand it.

I have not looked into it to see how much work it is yet, so I can't really say. One thing I noticed is that the new parser is much easier to extend than the previous iteration.

Prof. Victor Lazzarini
Maynooth University
Ireland

On 29 Jul 2025, at 17:51, Eduardo Moguillansky <[email protected]> wrote:


The parser is an area of csound which I know nothing about. How far is it from being able to implement named arguments at the call site and, with that, arbitrary default arguments?

On Tue, Jul 29, 2025 at 9:48 PM Victor Lazzarini <[email protected]<mailto:[email protected]>> wrote:
I’ve made a PR fixing this.
Optional types as per classic-style UDO are now allowed as types.

https://github.com/csound/csound/pull/2214

========================
Prof. Victor Lazzarini
Maynooth University
Ireland






> On 29 Jul 2025, at 19:35, Victor Lazzarini <[email protected]<mailto:[email protected]>> wrote:
>
> Defaults arguments are not implemented as far as I can see.
> This works - but I think it is a fluke.
>
> opcode myop(var1:i,var2:p):void
> print var1, var2
> endop
>
> Steven should be able to clarify. I’ll have a look at the code
>
> ========================
> Prof. Victor Lazzarini
> Maynooth University
> Ireland
>
>> On 29 Jul 2025, at 19:14, joachim heintz <[email protected]<mailto:[email protected]>> wrote:
>>
>> *Warning*
>>
>> This email originated from outside of Maynooth University's Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.
>>
>> in the old UDO syntax, we had opj etc for some default values of arguments.
>> is there something in the new UDO syntax?
>> i tried
>>      opcode test(arg1:i=1,arg2:i=13):void
>> but this did not work.
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.