[Issue 4545] Alias to members possible without "this" instance

2015-06-09 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=4545

Andrei Alexandrescu  changed:

   What|Removed |Added

Version|D1 & D2 |D2

--


[Issue 4545] Alias to members possible without "this" instance

2012-01-30 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4545


yebblies  changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 CC||yebbl...@gmail.com
 Resolution||DUPLICATE


--- Comment #11 from yebblies  2012-01-31 14:19:14 EST ---
*** This issue has been marked as a duplicate of issue 4062 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4545] Alias to members possible without "this" instance

2012-01-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4545


Walter Bright  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|INVALID |


--- Comment #10 from Walter Bright  2012-01-24 
02:27:17 PST ---
My mistake. I should read more carefully.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4545] Alias to members possible without "this" instance

2012-01-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4545



--- Comment #9 from Denis  2012-01-24 13:07:34 MSK 
---
(In reply to comment #8)
> (In reply to comment #7)
> > ---
> > alias s.i a;// illegal, s.i is an expression
> > ---
> > is still in the docs and compilable.
> 
> And it's not a bug.

As I understood everywhere in `statement.dd` "illegal" means incorrect
statement and it shouldn't be compilable. So "illegal" in `expression.dd` is
expected to do so too.

You reply means for me that those "illegal" statements doesn't compile with dmd
but it is implementation specific and an other D compiler may compile them fine
and it will result in undefined behavior. It will be a hell.

Or am I mistaken somewhere?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4545] Alias to members possible without "this" instance

2012-01-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4545


Walter Bright  changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution||INVALID


--- Comment #8 from Walter Bright  2012-01-24 
01:42:22 PST ---
(In reply to comment #7)
> ---
> alias s.i a;// illegal, s.i is an expression
> ---
> is still in the docs and compilable.

And it's not a bug.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4545] Alias to members possible without "this" instance

2012-01-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4545


Denis  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 CC||verylonglogin@gmail.com
 Resolution|FIXED   |


--- Comment #7 from Denis  2012-01-24 12:34:28 MSK 
---
---
alias s.i a;// illegal, s.i is an expression
---
is still in the docs and compilable.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4545] Alias to members possible without "this" instance

2012-01-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4545


Walter Bright  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||bugzi...@digitalmars.com
 Resolution||FIXED


--- Comment #6 from Walter Bright  2012-01-23 
21:38:52 PST ---
I'm not sure what to do with this. I did make some minor tweaks to the delegate
description. If more should be done, please be specific. I don't agree that the
behavoior Tomasz is reporting is a bug; it's expected.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4545] Alias to members possible without "this" instance

2012-01-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4545



--- Comment #5 from github-bugzi...@puremagic.com 2012-01-23 21:37:57 PST ---
Commit pushed to
https://github.com/D-Programming-Language/d-programming-language.org

https://github.com/D-Programming-Language/d-programming-language.org/commit/eedb99442ac037495ae12c3a7732aad72a074bf6
fix Issue 4545 - Alias to members possible without 'this' instance

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4545] Alias to members possible without "this" instance

2010-08-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4545



--- Comment #4 from Stewart Gordon  2010-08-07 07:21:22 PDT ---
(In reply to comment #3)
> (In reply to comment #2)
> > I'm not sure.  The existence of .funcptr seems to contradict
> > 
> > http://www.digitalmars.com/d/1.0/type.html#delegates
> > "There are no pointers-to-members in D, but a more useful concept called
> > delegates are supported."
> 
> Just after that it says: "Delegates are an aggregate of two pieces of data: an
> object reference and a function pointer.".

It really should say "a pointer to a non-static member function".

> You must always have a pointer to a
> member, then you add a context and gets a delegate. How about static members,
> you can have pointers to those, regular function pointers. I don't know why 
> the
> docs are written like that. Probably because the concept is a little different
> compared to C++'s member pointers. D's delegates are basically just syntax
> sugar for a C++'s member pointer and a instance of the same class.

No, because delegate types don't care the least what class the function is a
member of.  This is why they're more useful - whatever is using the delegate
need not know anything about the class, and so (for instance) a library can use
a delegate just like a plain function pointer.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4545] Alias to members possible without "this" instance

2010-08-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4545



--- Comment #3 from Jacob Carlborg  2010-08-07 07:01:32 PDT ---
(In reply to comment #2)
> I'm not sure.  The existence of .funcptr seems to contradict
> 
> http://www.digitalmars.com/d/1.0/type.html#delegates
> "There are no pointers-to-members in D, but a more useful concept called
> delegates are supported."

Just after that it says: "Delegates are an aggregate of two pieces of data: an
object reference and a function pointer.". You must always have a pointer to a
member, then you add a context and gets a delegate. How about static members,
you can have pointers to those, regular function pointers. I don't know why the
docs are written like that. Probably because the concept is a little different
compared to C++'s member pointers. D's delegates are basically just syntax
sugar for a C++'s member pointer and a instance of the same class.

> See also bug 2557.
> 
> Applies to D1 as well, though new A must be cast.  Moreover, you don't need to
> go through an alias - DMD 1.062 accepts even
> dg.funcptr = &A.foo;

I used an alias because an alias was used in the first example.

> But non-static members of structs/classes/unions are still compile-time
> entities, and they have properties.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4545] Alias to members possible without "this" instance

2010-08-07 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4545


Stewart Gordon  changed:

   What|Removed |Added

 CC||s...@iname.com
Version|D2  |D1 & D2


--- Comment #2 from Stewart Gordon  2010-08-07 05:31:59 PDT ---
I'm not sure.  The existence of .funcptr seems to contradict

http://www.digitalmars.com/d/1.0/type.html#delegates
"There are no pointers-to-members in D, but a more useful concept called
delegates are supported."

See also bug 2557.

Applies to D1 as well, though new A must be cast.  Moreover, you don't need to
go through an alias - DMD 1.062 accepts even
dg.funcptr = &A.foo;

But non-static members of structs/classes/unions are still compile-time
entities, and they have properties.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4545] Alias to members possible without "this" instance

2010-08-01 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4545


Jacob Carlborg  changed:

   What|Removed |Added

 CC||d...@me.com


--- Comment #1 from Jacob Carlborg  2010-08-01 15:29:55 PDT ---
I think your first example should be legal because you can create a delegate
out of the alias and an instance of A.

void delegate () dg;
dg.ptr = new A;
dg.funcptr = &goo;
dg(); // this works

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---