Re: [Vala] Request for new keyword "nobreak"
- From: "Nelson, Jim" <jim yorba org>
- To: Flemming Richter Mikkelsen <frm member fsf org>
- Cc: "vala-list gnome org" <vala-list gnome org>
- Subject: Re: [Vala] Request for new keyword "nobreak"
- Date: Thu, 24 Jan 2013 23:16:22 -0008
I don't know if it's been discussed for Vala, but I can assure you the debate over switch fallthrough has
been discussed to death.
I find the Vala approach to be quite sane. As a long-time C/C++ programmer, I've been burned one too many
times by switch fallthrough. I can't recall any instance where it actually was necessary. By necessary I
mean the other approaches were worse in measurable terms, not code aesthetics, which is more subjective than
people think.
I don't like the warning solution you suggested earlier. When it comes to syntax, if Vala supports or
doesn't support something, I would rather it be firm about it. Deprecated syntax is the only time I can
think a warning makes sense.
I wouldn't cry if nobreak was introduced, but I would question it. One thing about the C# syntax, as ugly as
it may be, is that it allows jumping to any other label, not merely falling through to the next. I could see
two or more case blocks wanting to jump to the default block. Of course, with this kind of power comes a lot
of potential for abuse.
I recommend getting buy-in from the Vala maintainers before working on a patch.
-- Jim
On Thu, Jan 24, 2013 at 3:06 PM, Flemming Richter Mikkelsen <frm member fsf org> wrote:
One thing I just though about was to use something like "!break".
But I think it could cause confusion, so I would prefer a new keyword (e.g.
"nobreak") or a compiler warning (instead of error).
Or is it possible to write "extern C {" around the switch statement? That
would not be exactly what I wanted, but would be good enough for me.
I might be able to make a patch if I get some spare time. But first I like
to see what the devs/maintainers think.
I know there has been some discussion around this before... but since what
I request is only useful in special cases, I don't know if this has ever
been dicussed proper.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]