Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #103460
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | David Brown <david.brown@hesbynett.no> |
| Newsgroups | comp.lang.c |
| Subject | Re: need {..} block, and switch case, need, and needs keywords |
| Date | Wed, 08 Feb 2017 14:30:47 +0100 |
| Organization | A noiseless patient Spider |
| Lines | 78 |
| Message-ID | <o7f6es$6f4$1@dont-email.me> (permalink) |
| References | <cccf37f2-ec4b-4780-a406-ac52f46e8c79@googlegroups.com> <o7c11a$ti7$1@dont-email.me> <812f2dea-9a1e-4286-9d57-2be0213f6a53@googlegroups.com> <o7elkr$f8u$1@dont-email.me> <bafcfb55-653d-4a9b-a349-17d410d48fca@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Wed, 8 Feb 2017 13:29:00 -0000 (UTC) |
| Injection-Info | mx02.eternal-september.org; posting-host="aac8a8afec3dd03b3e63b75c4406aa2d"; logging-data="6628"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+lXs0X3xOvfGR9ET3e8mAJyDiQAg5wvQU=" |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
| In-Reply-To | <bafcfb55-653d-4a9b-a349-17d410d48fca@googlegroups.com> |
| Cancel-Lock | sha1:DYYO2NOZiIeASA8eIyUnGfq9VYk= |
| Xref | csiph.com comp.lang.c:103460 |
Show key headers only | View raw
On 08/02/17 12:26, Rick C. Hodgin wrote:
> David Brown wrote:
>> It would make the "optional" or "discardable" nature of the call
>> to get_something at precisely the location you want -where
>> get_something is called.
>
> If that's your idea, then I'm back to programming every logic
> step manually, as in my original exame. The whole purpose of the
> needs {..} block is to simplify that while better documenting the code.
>
I think you must have misunderstood what I meant. My version of your
switch would be:
value = [[discardable]] get_something();
switch (x) {
case 0: break;
case 1: break;
case 2: break;
case 3:
// "value" is used here
break;
case 4:
value2 = get_something_else();
// "value" and "value2" are valid and in scope
break;
default:
// Not found
break;
}
>> And it would make the use of the variable "value" obvious
>> too - you use it if you need it, you don't use it if you don't need it.
>> Why should the programmer also have to write "needs value" as well?
>
> It documents what it needs in these cases where the value(s)
> are only needed in a subset of all formal cases, and it removes the
> mechanics of underlying work, substituting it with a descriptive name,
> making it easier to understand to new people examining the code.
>
> -----
> You have polar opposite thinking to mine on almost all areas.
> I have responded as much as I have, but I haven't seen anything
> positive come out of our exchanges, just rigid differences of views.
> I may stop responding to you because of it, as each post you offer
> feels like an certain type of attack.
>
If my posts feel like an attack, it is because you are not open to
discussion - you are not ready to accept that there can be other ideas
or ways to improve your ideas. Stop acting as though the /first/
thought that pops into your head has to be the /only/ thought - let your
ideas mature and warp through your own thought and discussions with
others. Let yourself be inspired by something other than your own ideas.
I will often criticise what you write - but it is /constructive/
criticism. Sometimes I feel an idea you have is absolutely daft and
counter-productive to good programming - and I will say so, rather than
lying to you. Your aim is to build a useful and productive programming
language, not a child's drawing to hang on the fridge. So if I feel you
are going in completely the wrong direction with something, that's what
I will say - because in my opinion, your time and energy would be better
spent in a different direction. It is, of course, entirely up to /you/
to decide if you agree with me - but I am advising you to the best of my
knowledge, not /attacking/ you or your work.
In this particular case, I think your idea is bad - I think it
introduces complications in syntax, extra keywords, and makes it hard
for a programmer to follow what is going on. However, it gave rise to
an alternative idea that I think is better - it has minimal syntax,
minimal extra effort for the programmer, but would be more useful in a
wider range of circumstances. If you don't like this new idea, then
that's fine - don't use it. But don't take it as an attack.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
need {..} block, and switch case, need, and needs keywords "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2017-02-06 07:57 -0800
Re: need {..} block, and switch case, need, and needs keywords BartC <bc@freeuk.com> - 2017-02-06 16:23 +0000
Re: need {..} block, and switch case, need, and needs keywords "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2017-02-06 08:36 -0800
Re: need {..} block, and switch case, need, and needs keywords David Brown <david.brown@hesbynett.no> - 2017-02-07 09:39 +0100
Re: need {..} block, and switch case, need, and needs keywords "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2017-02-07 07:32 -0800
Re: need {..} block, and switch case, need, and needs keywords David Brown <david.brown@hesbynett.no> - 2017-02-08 09:43 +0100
Re: need {..} block, and switch case, need, and needs keywords "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2017-02-08 03:26 -0800
Re: need {..} block, and switch case, need, and needs keywords David Brown <david.brown@hesbynett.no> - 2017-02-08 14:30 +0100
Re: need {..} block, and switch case, need, and needs keywords "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2017-02-08 05:38 -0800
Re: need {..} block, and switch case, need, and needs keywords "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2017-02-08 05:43 -0800
csiph-web