Csound Csound-dev Csound-tekno Search About

[Csnd-dev] break and continue

Date2025-10-13 12:11
FromVictor Lazzarini <000010b17ddd988e-dmarc-request@LISTSERV.HEANET.IE>
Subject[Csnd-dev] break and continue
Hi all,

with thanks to @scottsitar we now have break and continue in while, until, and
for loops. 

What we’d like to discuss here now is how switch should be handled. At the
moment, switch has an implicit break. This means it cannot be used in fall-through
scenarios (as far as I can see). Discussing briefly this in the PR we considered two
options:

(a) modify switch to take an explicit break (like in C)
(b) add a fall-through statement (like in go)

The advantage of (a) is that we don’t need a new keyword and we are in line with
the most common approach (?). The advantage of (b) is that no user-level changes
to switch are needed.

I have no preference myself. Would be interesting to hear opinions.

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







Date2025-10-13 12:53
FromEduardo Moguillansky
SubjectRe: [Csnd-dev] break and continue
Csound being mostly used by non-professional programmers, simplicity and terseness are probably more important than compliance. In that sense, an implicit break seems better: we spare the need of a break line for every case and also avoid unwanted fall-through mistakes. 

Eduardo


On Mon, Oct 13, 2025 at 1:12 PM Victor Lazzarini <000010b17ddd988e-dmarc-request@listserv.heanet.ie> wrote:
Hi all,

with thanks to @scottsitar we now have break and continue in while, until, and
for loops.

What we’d like to discuss here now is how switch should be handled. At the
moment, switch has an implicit break. This means it cannot be used in fall-through
scenarios (as far as I can see). Discussing briefly this in the PR we considered two
options:

(a) modify switch to take an explicit break (like in C)
(b) add a fall-through statement (like in go)

The advantage of (a) is that we don’t need a new keyword and we are in line with
the most common approach (?). The advantage of (b) is that no user-level changes
to switch are needed.

I have no preference myself. Would be interesting to hear opinions.

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







Date2025-10-13 12:58
FromRory Walsh
SubjectRe: [Csnd-dev] break and continue
+1

On Mon, 13 Oct 2025 at 12:54, Eduardo Moguillansky <eduardo.moguillansky@gmail.com> wrote:
Csound being mostly used by non-professional programmers, simplicity and terseness are probably more important than compliance. In that sense, an implicit break seems better: we spare the need of a break line for every case and also avoid unwanted fall-through mistakes. 

Eduardo


On Mon, Oct 13, 2025 at 1:12 PM Victor Lazzarini <000010b17ddd988e-dmarc-request@listserv.heanet.ie> wrote:
Hi all,

with thanks to @scottsitar we now have break and continue in while, until, and
for loops.

What we’d like to discuss here now is how switch should be handled. At the
moment, switch has an implicit break. This means it cannot be used in fall-through
scenarios (as far as I can see). Discussing briefly this in the PR we considered two
options:

(a) modify switch to take an explicit break (like in C)
(b) add a fall-through statement (like in go)

The advantage of (a) is that we don’t need a new keyword and we are in line with
the most common approach (?). The advantage of (b) is that no user-level changes
to switch are needed.

I have no preference myself. Would be interesting to hear opinions.

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







Date2025-10-13 18:45
FromSteven Yi
SubjectRe: [Csnd-dev] break and continue
+1 to implicit break.

On Mon, Oct 13, 2025 at 7:56 AM Rory Walsh  wrote:
>
> +1
>
> On Mon, 13 Oct 2025 at 12:54, Eduardo Moguillansky  wrote:
>>
>> Csound being mostly used by non-professional programmers, simplicity and terseness are probably more important than compliance. In that sense, an implicit break seems better: we spare the need of a break line for every case and also avoid unwanted fall-through mistakes.
>>
>> Eduardo
>>
>>
>> On Mon, Oct 13, 2025 at 1:12 PM Victor Lazzarini <000010b17ddd988e-dmarc-request@listserv.heanet.ie> wrote:
>>>
>>> Hi all,
>>>
>>> with thanks to @scottsitar we now have break and continue in while, until, and
>>> for loops.
>>>
>>> What we’d like to discuss here now is how switch should be handled. At the
>>> moment, switch has an implicit break. This means it cannot be used in fall-through
>>> scenarios (as far as I can see). Discussing briefly this in the PR we considered two
>>> options:
>>>
>>> (a) modify switch to take an explicit break (like in C)
>>> (b) add a fall-through statement (like in go)
>>>
>>> The advantage of (a) is that we don’t need a new keyword and we are in line with
>>> the most common approach (?). The advantage of (b) is that no user-level changes
>>> to switch are needed.
>>>
>>> I have no preference myself. Would be interesting to hear opinions.
>>>
>>> best
>>> ========================
>>> Prof. Victor Lazzarini
>>> Maynooth University
>>> Ireland
>>>
>>>
>>>
>>>
>>>
>>>

Date2025-10-14 16:20
FromDave Seidel
SubjectRe: [Csnd-dev] break and continue
+1

On Mon, Oct 13, 2025, 7:54 AM Eduardo Moguillansky <eduardo.moguillansky@gmail.com> wrote:
Csound being mostly used by non-professional programmers, simplicity and terseness are probably more important than compliance. In that sense, an implicit break seems better: we spare the need of a break line for every case and also avoid unwanted fall-through mistakes. 

Eduardo


On Mon, Oct 13, 2025 at 1:12 PM Victor Lazzarini <000010b17ddd988e-dmarc-request@listserv.heanet.ie> wrote:
Hi all,

with thanks to @scottsitar we now have break and continue in while, until, and
for loops.

What we’d like to discuss here now is how switch should be handled. At the
moment, switch has an implicit break. This means it cannot be used in fall-through
scenarios (as far as I can see). Discussing briefly this in the PR we considered two
options:

(a) modify switch to take an explicit break (like in C)
(b) add a fall-through statement (like in go)

The advantage of (a) is that we don’t need a new keyword and we are in line with
the most common approach (?). The advantage of (b) is that no user-level changes
to switch are needed.

I have no preference myself. Would be interesting to hear opinions.

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