Jump to page: 1 2 3
Thread overview
Method invocation -- why it's not working?
Mar 07, 2012
Comrad
Mar 07, 2012
Simen Kjærås
Mar 07, 2012
Ali Çehreli
Mar 08, 2012
Ali Çehreli
Mar 08, 2012
Andrej Mitrovic
Mar 08, 2012
Comrad
Mar 08, 2012
H. S. Teoh
Mar 08, 2012
Jonathan M Davis
Mar 08, 2012
Comrad
Mar 08, 2012
Jonathan M Davis
Mar 08, 2012
Kapps
Mar 08, 2012
Jonathan M Davis
Mar 10, 2012
Comrad
Mar 08, 2012
H. S. Teoh
Mar 09, 2012
Jonathan M Davis
Mar 09, 2012
H. S. Teoh
Mar 09, 2012
Jonathan M Davis
Mar 09, 2012
H. S. Teoh
Mar 09, 2012
Andrej Mitrovic
Mar 09, 2012
Timon Gehr
Mar 10, 2012
Andrej Mitrovic
Mar 09, 2012
Andrej Mitrovic
Mar 09, 2012
Jonathan M Davis
March 07, 2012
  1 struct A
  2 {
  3   double[2] _x;
  4 }
  5
  6 @property ref double y(ref A a) {return a._x[1];}
  7
  8 void main()
  9 {
 10   A a1;
 11   a1.y=2.;
 12 }

dmd test.d gives me:

Error: no property 'y' for type 'A'


March 07, 2012
On Thu, 08 Mar 2012 00:21:36 +0100, Comrad <comrad.karlovich@googlemail.com> wrote:

>    1 struct A
>    2 {
>    3   double[2] _x;
>    4 }
>    5
>    6 @property ref double y(ref A a) {return a._x[1];}
>    7
>    8 void main()
>    9 {
>   10   A a1;
>   11   a1.y=2.;
>   12 }
>
> dmd test.d gives me:
>
> Error: no property 'y' for type 'A'

Uniform function call syntax is not implemented. Due to what
was originally a bug, it works for arrays.
March 07, 2012
On 03/07/2012 03:21 PM, Comrad wrote:
> 1 struct A
> 2 {
> 3 double[2] _x;
> 4 }
> 5
> 6 @property ref double y(ref A a) {return a._x[1];}
> 7
> 8 void main()
> 9 {
> 10 A a1;
> 11 a1.y=2.;
> 12 }
>
> dmd test.d gives me:
>
> Error: no property 'y' for type 'A'
>
>

You are testing out the new UFCS, right? Well, I really really hope that I will be embarrassed by saying this: That feature has been DOA! :p

So many people celebrated the feature on the D.announce newsgroup. I've pointed out a number of times that I couldn't get even the simplest test.

And there is a unittest that tests the feature but nope... It just doesn't work. :(

Ali

March 08, 2012
On 03/07/2012 03:54 PM, Ali Çehreli wrote:
> On 03/07/2012 03:21 PM, Comrad wrote:
>  > 1 struct A
>  > 2 {
>  > 3 double[2] _x;
>  > 4 }
>  > 5
>  > 6 @property ref double y(ref A a) {return a._x[1];}
>  > 7
>  > 8 void main()
>  > 9 {
>  > 10 A a1;
>  > 11 a1.y=2.;
>  > 12 }
>  >
>  > dmd test.d gives me:
>  >
>  > Error: no property 'y' for type 'A'
>  >
>  >
>
> You are testing out the new UFCS, right? Well, I really really hope that
> I will be embarrassed by saying this: That feature has been DOA! :p
>
> So many people celebrated the feature on the D.announce newsgroup. I've
> pointed out a number of times that I couldn't get even the simplest test.
>
> And there is a unittest that tests the feature but nope... It just
> doesn't work. :(
>
> Ali
>

Ok, now I see how I fooled myself. Posts like the following made me think that UFCS has been implemented even for ints:

  http://forum.dlang.org/post/jhfpca$1bf4$1@digitalmars.com

I made a further mistake and parsed the unittest in the following change as using an 'int'. Obviously I was wrong: it is the string literal "1":


https://github.com/D-Programming-Language/dmd/commit/c268c4a2dc20aae024bce81555833b806a56f718

Ali
March 08, 2012
Don't worry Ali I thought the same thing. :p
March 08, 2012
On Thursday, 8 March 2012 at 00:04:55 UTC, Ali Çehreli wrote:
> On 03/07/2012 03:54 PM, Ali Çehreli wrote:
>> On 03/07/2012 03:21 PM, Comrad wrote:
>> > 1 struct A
>> > 2 {
>> > 3 double[2] _x;
>> > 4 }
>> > 5
>> > 6 @property ref double y(ref A a) {return a._x[1];}
>> > 7
>> > 8 void main()
>> > 9 {
>> > 10 A a1;
>> > 11 a1.y=2.;
>> > 12 }
>> >
>> > dmd test.d gives me:
>> >
>> > Error: no property 'y' for type 'A'
>> >
>> >
>>
>> You are testing out the new UFCS, right? Well, I really really hope that
>> I will be embarrassed by saying this: That feature has been DOA! :p
>>
>> So many people celebrated the feature on the D.announce newsgroup. I've
>> pointed out a number of times that I couldn't get even the simplest test.
>>
>> And there is a unittest that tests the feature but nope... It just
>> doesn't work. :(
>>
>> Ali
>>
>
> Ok, now I see how I fooled myself. Posts like the following made me think that UFCS has been implemented even for ints:
>
>   http://forum.dlang.org/post/jhfpca$1bf4$1@digitalmars.com
>
> I made a further mistake and parsed the unittest in the following change as using an 'int'. Obviously I was wrong: it is the string literal "1":
>
>
> https://github.com/D-Programming-Language/dmd/commit/c268c4a2dc20aae024bce81555833b806a56f718
>
> Ali

Basically, I was following Andrei's book, where this feature is described. It's a pity, that it's not working (except arrays somehow) :( - I need it!

March 08, 2012
On Thu, Mar 08, 2012 at 07:32:18AM +0100, Comrad wrote: [...]
> Basically, I was following Andrei's book, where this feature is
> described. It's a pity, that it's not working (except arrays somehow)
> :( - I need it!

Yeah there are some features in the book that aren't completely implemented yet. They are being looked into with high priority.


T

-- 
Acid falls with the rain; with love comes the pain.
March 08, 2012
On Wednesday, March 07, 2012 22:40:02 H. S. Teoh wrote:
> On Thu, Mar 08, 2012 at 07:32:18AM +0100, Comrad wrote: [...]
> 
> > Basically, I was following Andrei's book, where this feature is described. It's a pity, that it's not working (except arrays somehow)
> > 
> > :( - I need it!
> 
> Yeah there are some features in the book that aren't completely implemented yet. They are being looked into with high priority.

True. But I would point out that TDPL never actually says that it works with all types. It only shows it with arrays. Now, it's not entirely clear on whether it's supposed to work with all types, but it definitely doesn't say that it does. It wouldn't surprise me at all if Andrei wrote it with the intention that it was only supposed to work with arrays but wasn't clear enough in his description.

Still, there are definitely a lot of people who want it to work with all types, so it's likely that it will be expanded to work with more types. Whether it will ever work with _all_ types is somewhat in question due to ambiguity issues involving structs and classes (e.g. when a member function and a free function using UFCS would conflict). But there's a decent chance that that will be resolved and UFCS will end up working for all types. Until then though, all it works with is arrays.

- Jonathan M Davis
March 08, 2012
On Thursday, 8 March 2012 at 06:43:45 UTC, Jonathan M Davis wrote:
> On Wednesday, March 07, 2012 22:40:02 H. S. Teoh wrote:
>> On Thu, Mar 08, 2012 at 07:32:18AM +0100, Comrad wrote:
>> [...]
>> 
>> > Basically, I was following Andrei's book, where this feature is
>> > described. It's a pity, that it's not working (except arrays somehow)
>> > 
>> > :( - I need it!
>> 
>> Yeah there are some features in the book that aren't completely
>> implemented yet. They are being looked into with high priority.
>
> True. But I would point out that TDPL never actually says that it works with
> all types. It only shows it with arrays. Now, it's not entirely clear on
> whether it's supposed to work with all types, but it definitely doesn't say
> that it does. It wouldn't surprise me at all if Andrei wrote it with the
> intention that it was only supposed to work with arrays but wasn't clear
> enough in his description.

It's not correct. In TDPL it is clearly stated, that this is a general feature
of the language.


>
> Still, there are definitely a lot of people who want it to work with all types,
> so it's likely that it will be expanded to work with more types. Whether it
> will ever work with _all_ types is somewhat in question due to ambiguity
> issues involving structs and classes (e.g. when a member function and a free
> function using UFCS would conflict). But there's a decent chance that that will
> be resolved and UFCS will end up working for all types. Until then though, all
> it works with is arrays.
>
> - Jonathan M Davis

Anyway, for structures this feature is really needed.

March 08, 2012
On Thursday, March 08, 2012 08:37:38 Comrad wrote:
> On Thursday, 8 March 2012 at 06:43:45 UTC, Jonathan M Davis wrote:
> > On Wednesday, March 07, 2012 22:40:02 H. S. Teoh wrote:
> >> On Thu, Mar 08, 2012 at 07:32:18AM +0100, Comrad wrote: [...]
> >> 
> >> > Basically, I was following Andrei's book, where this feature
> >> > is
> >> > described. It's a pity, that it's not working (except arrays
> >> > somehow)
> >> > 
> >> > :( - I need it!
> >> 
> >> Yeah there are some features in the book that aren't completely implemented yet. They are being looked into with high priority.
> > 
> > True. But I would point out that TDPL never actually says that
> > it works with
> > all types. It only shows it with arrays. Now, it's not entirely
> > clear on
> > whether it's supposed to work with all types, but it definitely
> > doesn't say
> > that it does. It wouldn't surprise me at all if Andrei wrote it
> > with the
> > intention that it was only supposed to work with arrays but
> > wasn't clear
> > enough in his description.
> 
> It's not correct. In TDPL it is clearly stated, that this is a
> general feature
> of the language.

Then please give me a page number. Last time I looked it over, I saw _nothing_ which said that it worked on types in general, and _all_ examples used arrays.

> > Still, there are definitely a lot of people who want it to work
> > with all types,
> > so it's likely that it will be expanded to work with more
> > types. Whether it
> > will ever work with _all_ types is somewhat in question due to
> > ambiguity
> > issues involving structs and classes (e.g. when a member
> > function and a free
> > function using UFCS would conflict). But there's a decent
> > chance that that will
> > be resolved and UFCS will end up working for all types. Until
> > then though, all
> > it works with is arrays.
> > 
> > - Jonathan M Davis
> 
> Anyway, for structures this feature is really needed.

It would be nice, but I honestly don't understand the people who think that the lack of it is crippling. It's just one of those nice-to-have features. Most languages don't have anything of the sort.

- Jonathan M Davis
« First   ‹ Prev
1 2 3