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


Groups > comp.lang.c > #123738

Re: C needs to evolve

From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.lang.c
Subject Re: C needs to evolve
Date 2017-12-03 11:23 +1300
Message-ID <f8gnfjFrrtU3@mid.individual.net> (permalink)
References <4d2a3d73-c48a-46e4-96ae-034dc6ae7ea1@googlegroups.com> <4adb49b3-1758-472b-9b32-47b7318e559d@googlegroups.com> <ad7cbaac-9635-4284-8dda-177942d0bb16@googlegroups.com>

Show all headers | View raw


On 12/03/2017 08:51 AM, Thiago Adams wrote:
> On Friday, December 1, 2017 at 9:50:45 PM UTC-2, zaca...@gmail.com wrote:
>> To be clear, I don't necessarily want classes, but I do like structure, for example:
>>
>> void myFunction( void );
>>
>> struct {
>>      const char* data;
>>      void (*func)( void );
>> } myStruct = {"Hello World!", myFunction};
>>
>> void myFunction(void)
>> {
>>      printf("%s\n", myStruct.data);
>> }
>>
>> but I would like to be able to do it without so much hassle...
> 
> 
> What I dislike about C++ member functions is the asymmetry
> caused on the syntax.
> 
> We can use:
> 
>     obj.Function() ;
>     or
>     Function(Obj);

So which would you prohibit, objects with members or functions accepting 
object as parameters?  I can't think of a language which supports OO and 
not both.

> Trying to put everything as member functions is a bad
> idea. see
> 
> http://www.drdobbs.com/cpp/how-non-member-functions-improve-encapsu/184401197

Does anyone dispute that?

The rest is best discussed down the hall..

-- 
Ian

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


Thread

Re: C needs to evolve zacariaz@gmail.com - 2017-12-01 15:50 -0800
  Re: C needs to evolve Thiago Adams <thiago.adams@gmail.com> - 2017-12-02 11:51 -0800
    Re: C needs to evolve Ian Collins <ian-news@hotmail.com> - 2017-12-03 11:23 +1300
      Re: C needs to evolve Thiago Adams <thiago.adams@gmail.com> - 2017-12-03 12:57 -0800
        Re: C needs to evolve Thiago Adams <thiago.adams@gmail.com> - 2017-12-03 16:06 -0800

csiph-web