Re: [Vala] Request for new keyword "nobreak"



On Jan 25, 2013 12:24 AM, "Nelson, Jim" <jim yorba org> wrote:

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.

Yes.  This is a sensitive issue as many have strong feelings about this.
That is why I was hoping it would be possible to please everybody.

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.

There are cases, but they are not common.

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 am used to C and GCC where warnings can be swiched on or off with
compiler flags.  This would somehow justify it, but it is not perfect.

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.

Which is why I try to avoid goto unless I write low level code.

To me, the worst abuse is bad indentation.  Too bad Vala didn't solve that.
I also dislike operator overloading, overriding and public/global
variables, comparing floats with ints, use of basic types when one could be
specific, not using const keyword, dead or duplicated code, etc.

As a software system designer, I have seen very poor coding habits, and can
give many examples.
When each person has their own style in common code, the result ends up
unreadable.

I think this nobreak would be clean, but it is always a bad side-effect
when changes are introduced, but I think this would not cause big problems
since "nobreak" is not a popular variable name.

I recommend getting buy-in from the Vala maintainers before working on a
patch.

Yes.  They need to be convinced and I am generally bad at convincing
people.  But I have been thinking about this for some time and could not
find any good arguments to not implement it.

But maybe there is a better way to solve this than with a new keyword.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]