Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Ian Collins Newsgroups: comp.lang.c Subject: Re: C needs to evolve Date: Sun, 3 Dec 2017 11:23:47 +1300 Lines: 43 Message-ID: References: <4d2a3d73-c48a-46e4-96ae-034dc6ae7ea1@googlegroups.com> <4adb49b3-1758-472b-9b32-47b7318e559d@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net /xMBctjeZ4v3/83ewDgURwWZ6eZFs2enXJxVsrH5lkmjB1wUY7 Cancel-Lock: sha1:0igMRJ6c5Tn0pieIJIwhPXGnZZY= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 In-Reply-To: Content-Language: en-US Xref: csiph.com comp.lang.c:123738 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