Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #138775

Re: Shorthand ~> pointers

From David Brown <david.brown@hesbynett.no>
Newsgroups comp.lang.c
Subject Re: Shorthand ~> pointers
Date 2018-12-20 13:46 +0100
Organization A noiseless patient Spider
Message-ID <pvg2ve$i7f$1@dont-email.me> (permalink)
References <pveuu6$b8l$1@dont-email.me> <slrn3m64q1mrd6.lf2.andrews@sdf.lonestar.org> <wRKSD.101504$nd2.35819@fx22.am4>

Show all headers | View raw


On 20/12/18 12:15, Bart wrote:
> On 20/12/2018 10:23, Andrew Smallshaw wrote:
>> On 2018-12-20, Rick C. Hodgin <rick.c.hodgin@gmail.com> wrote:
>>> I've had the idea to introduce the ~> symbol for shorthand pointers.
>>
>>> It would only work for uniquely named members, but could also be
>>> used from a relative point where, from that point down the rest
>>> of the hierarchy it is then unique.
>>
>> What an absolutely horrid idea.  So adding a new variable to a
>> structure causes well-written code to break when it was fine before?
>> I can see that going down like a lead balloon in large code bases.
> 
> That already happens with scopes:
> 
> int a;              // A1
>     {
>         {
>             a;      // reference A1
> 
> This works fine. Until somebody introduces a new scope for 'a' between
> these two:
> 
> int a;              // A1
>     {int a;         // A2
>         {
>             a;      // now references A2
> 
> The code lower down now breaks. In this case, the code is still legal
> and the change could go undetected unless your compiler can warn you
> about shadowing. Which then means you won't be able to use such
> shadowing even when you want to.
> 

The key difference is that this is a change at the point of use of the
code, while the problem with ~> pointers is that an unrelated addition
in a different part of the code (perhaps a header somewhere) can break
the existing code.

I am not sure that this is a killer problem for the feature, but it is
definitely a disadvantage.  Even though I don't see your particular
example as being a parallel case of code breakage, there are plenty of
other ways for adding new code in one place to affect independent code.

Combined with the rather difficult to read syntax, and the limited
usage, it is not a feature that would get my vote.  (Not that Rick would
count my vote anyway!).

C and C++ already have language features that are convenient for such
short-hand coding:

	SExample* e = generate_new_e();

	// Traditional
	e->child->gc.gcInt = 5;

	// C
	SGrandChild * gc = &e->child->gc;
	gc->gcInt = 5;

	// C++
	auto& gc = e->child->gc;
	gc.gcInt = 5;


If the C syntax is not nice enough, then the C++ version could be adopted.


> 
>> I really don't see the point in these "let's improve C" discussions
>> in the first place, as if an idea is ever going to get traction
>> simply by being posted here, but at least any proposals could have
>> had more that 10 seconds consideration by the OP before posting.
> 

I'm assuming Rick's post is about suggestions for his own language,
rather than C.

> So how did the myriad gcc extensions ever get 'traction'?
> 

It's worth noting that gcc add very little in the way of extensions
these days.  Most of their C extensions were from the the pre-C99 days,
with a number of their ideas making it into the C99 standards.

It takes a lot to get an extension into C.  Merely being an
"improvement" is not enough.

> (I normally make short work of Rick's proposals, but this one I'm stil
> thinking about.)
> 

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-19 21:31 -0500
  Re: Shorthand ~> pointers bitrex <user@example.net> - 2018-12-20 03:29 -0500
    Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-20 06:40 -0500
  Re: Shorthand ~> pointers Andrew Smallshaw <andrews@sdf.org> - 2018-12-20 10:23 +0000
    Re: Shorthand ~> pointers Bart <bc@freeuk.com> - 2018-12-20 11:15 +0000
      Re: Shorthand ~> pointers David Brown <david.brown@hesbynett.no> - 2018-12-20 13:46 +0100
        Re: Shorthand ~> pointers mark.bluemel@gmail.com - 2018-12-20 05:04 -0800
          Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-20 05:11 -0800
    Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-20 03:25 -0800
    Re: Shorthand ~> pointers Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-12-20 11:51 +0000
      Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-20 06:54 -0500
        Re: Shorthand ~> pointers Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-12-20 12:17 +0000
          Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-20 07:21 -0500
            Re: Shorthand ~> pointers Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-12-20 14:18 +0000
              Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-20 09:26 -0500
          Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-20 04:29 -0800
            Re: Shorthand ~> pointers mark.bluemel@gmail.com - 2018-12-20 04:46 -0800
            Re: Shorthand ~> pointers David Brown <david.brown@hesbynett.no> - 2018-12-20 15:00 +0100
      Re: Shorthand ~> pointers scott@slp53.sl.home (Scott Lurndal) - 2018-12-20 14:26 +0000
        Re: Shorthand ~> pointers Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-12-20 15:03 +0000
        Re: Shorthand ~> pointers James Kuyper <jameskuyper@alumni.caltech.edu> - 2018-12-20 07:05 -0800
  Re: Shorthand ~> pointers "Fred.Zwarts" <F.Zwarts@KVI.nl> - 2018-12-20 11:16 +0100
    Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-20 07:16 -0500
  Re: Shorthand ~> pointers Bart <bc@freeuk.com> - 2018-12-20 12:39 +0000
    Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-20 08:20 -0500
      Re: Shorthand ~> pointers Bart <bc@freeuk.com> - 2018-12-20 14:02 +0000
        Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-20 09:15 -0500
          Re: Shorthand ~> pointers Bart <bc@freeuk.com> - 2018-12-20 17:48 +0000
    Re: Shorthand ~> pointers Juha Nieminen <nospam@thanks.invalid> - 2018-12-21 11:36 +0000
      Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-21 08:05 -0500
        Re: Shorthand ~> pointers scott@slp53.sl.home (Scott Lurndal) - 2018-12-21 14:56 +0000
          Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-21 10:03 -0500
            Re: Shorthand ~> pointers scott@slp53.sl.home (Scott Lurndal) - 2018-12-21 15:35 +0000
              Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-21 10:41 -0500
                Re: Shorthand ~> pointers Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2018-12-21 15:41 +0000
                Re: Shorthand ~> pointers scott@slp53.sl.home (Scott Lurndal) - 2018-12-21 17:04 +0000
                Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-21 12:23 -0500
        Re: Shorthand ~> pointers scott@slp53.sl.home (Scott Lurndal) - 2018-12-21 14:57 +0000
          Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-21 10:20 -0500
            Re: Shorthand ~> pointers scott@slp53.sl.home (Scott Lurndal) - 2018-12-21 15:37 +0000
              Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-21 10:42 -0500
                Re: Shorthand ~> pointers Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2018-12-21 15:42 +0000
                Re: Shorthand ~> pointers David Brown <david.brown@hesbynett.no> - 2018-12-21 17:39 +0100
                Re: Shorthand ~> pointers scott@slp53.sl.home (Scott Lurndal) - 2018-12-21 17:05 +0000
                Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-21 12:24 -0500
                Re: Shorthand ~> pointers "Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid> - 2018-12-21 23:49 -0800
                Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-22 13:05 -0500
                Re: Shorthand ~> pointers "Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid> - 2018-12-22 16:38 -0800
        Re: Shorthand ~> pointers Juha Nieminen <nospam@thanks.invalid> - 2018-12-22 18:39 +0000
          Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-22 13:42 -0500
            Re: Shorthand ~> pointers "Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid> - 2018-12-22 16:23 -0800
              Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-22 21:52 -0500
                Re: Shorthand ~> pointers "Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid> - 2018-12-22 20:26 -0800
                Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-22 23:54 -0500
                Re: Shorthand ~> pointers Ben Bacarisse <ben.usenet@bsb.me.uk> - 2018-12-23 12:43 +0000
                Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-23 08:34 -0500
                Re: Shorthand ~> pointers James Kuyper <jameskuyper@alumni.caltech.edu> - 2018-12-23 08:09 -0800
                Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-23 11:56 -0500
            Re: Shorthand ~> pointers Juha Nieminen <nospam@thanks.invalid> - 2018-12-23 08:24 +0000
              Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-23 08:24 -0500
                Re: Shorthand ~> pointers Bart <bc@freeuk.com> - 2018-12-23 15:28 +0000
                Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-23 12:15 -0500
                Re: Shorthand ~> pointers Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2018-12-23 17:24 +0000
                Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-23 12:35 -0500
                Re: Shorthand ~> pointers Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2018-12-23 17:39 +0000
                Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-23 14:07 -0500
                Re: Shorthand ~> pointers Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2018-12-23 19:17 +0000
                Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-23 14:52 -0500
                Re: Shorthand ~> pointers Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2018-12-23 21:14 +0000
                Re: Shorthand ~> pointers Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2018-12-23 21:36 +0000
                Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-23 19:24 -0500
                Re: Shorthand ~> pointers Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2018-12-24 10:14 +0000
                Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-24 07:53 -0500
                Re: Shorthand ~> pointers gazelle@shell.xmission.com (Kenny McCormack) - 2018-12-24 14:16 +0000
                Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-24 10:17 -0500
                Re: Shorthand ~> pointers Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2018-12-24 15:36 +0000
                Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-24 10:43 -0500
                Re: Shorthand ~> pointers Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2018-12-24 15:46 +0000
                Re: Shorthand ~> pointers "Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid> - 2018-12-24 14:16 -0800
                Re: Shorthand ~> pointers Melzzzzz <Melzzzzz@zzzzz.com> - 2018-12-24 22:36 +0000
                Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-24 18:35 -0500
                Re: Shorthand ~> pointers "Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid> - 2018-12-24 15:44 -0800
                Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-24 18:55 -0500
                Re: Shorthand ~> pointers "Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid> - 2018-12-25 22:20 -0800
                Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-26 05:32 -0500
                You are so full of shit (Was: Shorthand ~> pointers) gazelle@shell.xmission.com (Kenny McCormack) - 2018-12-26 14:10 +0000
                Re: You are so full of .. (Was: Shorthand ~> pointers) "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-26 09:47 -0500
                Re: You are so full of shit (Was: Shorthand ~> pointers) gazelle@shell.xmission.com (Kenny McCormack) - 2018-12-26 15:21 +0000
                Re: Shorthand ~> pointers Ian Collins <ian-news@hotmail.com> - 2018-12-24 08:26 +1300
                Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-23 15:02 -0500
                Re: Shorthand ~> pointers Tim Rentsch <txr@alumni.caltech.edu> - 2018-12-28 08:21 -0800
                Re: Shorthand ~> pointers nobody@example.org (Scott) - 2018-12-25 03:56 +0000
                Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-24 23:55 -0500
                Re: Shorthand ~> pointers Richard Damon <Richard@Damon-Family.org> - 2018-12-25 10:14 -0500
                Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-25 10:36 -0500
                Re: Shorthand ~> pointers Juha Nieminen <nospam@thanks.invalid> - 2018-12-24 14:22 +0000
                Re: Shorthand ~> pointers "Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid> - 2018-12-24 15:47 -0800
            Re: Shorthand ~> pointers Reinhardt Behm <rbehm@hushmail.com> - 2018-12-23 16:31 +0800
              Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-23 08:28 -0500
  Re: Shorthand ~> pointers nobody@example.org (Scott) - 2018-12-21 01:14 +0000
    Re: Shorthand ~> pointers "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2018-12-21 03:23 +0100
      Re: Shorthand ~> pointers nobody@example.org (Scott) - 2018-12-21 09:45 +0000
        Re: Shorthand ~> pointers David Brown <david.brown@hesbynett.no> - 2018-12-21 12:05 +0100
        Re: Shorthand ~> pointers Vir Campestris <vir.campestris@invalid.invalid> - 2018-12-21 21:24 +0000
          Re: Shorthand ~> pointers scott@slp53.sl.home (Scott Lurndal) - 2018-12-21 21:47 +0000
          Re: Shorthand ~> pointers David Brown <david.brown@hesbynett.no> - 2018-12-22 16:09 +0100
            Re: Shorthand ~> pointers Richard Damon <Richard@Damon-Family.org> - 2018-12-22 11:49 -0500
              Re: Shorthand ~> pointers Bart <bc@freeuk.com> - 2018-12-22 18:41 +0000
                Re: Shorthand ~> pointers Anton Shepelev <anton.txt@gmail.com> - 2018-12-22 21:48 +0300
                Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-22 14:00 -0500
                Re: Shorthand ~> pointers Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2018-12-22 19:08 +0000
                Re: Shorthand ~> pointers fir <profesor.fir@gmail.com> - 2018-12-22 16:42 -0800
                Re: Shorthand ~> pointers Richard Damon <Richard@Damon-Family.org> - 2018-12-22 17:10 -0500
                Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-22 17:42 -0500
                Re: Shorthand ~> pointers Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2018-12-23 10:19 +0000
                Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-23 08:40 -0500
              Re: Shorthand ~> pointers Jorgen Grahn <grahn+nntp@snipabacken.se> - 2018-12-25 21:00 +0000
    Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-21 07:57 -0500
  Re: Shorthand ~> pointers Bonita Montero <Bonita.Montero@gmail.com> - 2018-12-24 14:38 +0100
    Re: Shorthand ~> pointers "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2018-12-24 10:26 -0500
      Re: Shorthand ~> pointers Bonita Montero <Bonita.Montero@gmail.com> - 2018-12-28 13:35 +0100

csiph-web