www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Support alias this in module scope?

reply Manu <turkeyman gmail.com> writes:
Okay, I'm still really angry about the stupid stupid decision to make
C++ namespaces into scopes rather than just a detail used for
mangling, with absolutely no consultation of the community, in
particular the target audience, who are unanimously annoyed as far as
I can tell...

I'm unsatisfied by the work-arounds to make the situation not-suck,
but I think I have an idea that would pacify me...

If we can use `alias this` to mirror an entire C++ namespace into the
location we want (ie, the scope immediately outside the C++
namespace!!), then one sanitary line would make the problem quite more
tolerable:

extern(C++, FuckOff)
{
  void bah();
  void humbug();
}
alias this FuckOff;  // <-- symbols are now aliased where they should
have been all along



(count the seconds until the reply that says to use reflection to scan
the scope, and use a mixin to... blah blah)
May 22 2018
next sibling parent reply Stefan Koch <uplink.coder googlemail.com> writes:
On Wednesday, 23 May 2018 at 03:44:36 UTC, Manu wrote:
 Okay, I'm still really angry about the stupid stupid decision 
 to make C++ namespaces into scopes rather than just a detail 
 used for mangling, with absolutely no consultation of the 
 community, in particular the target audience, who are 
 unanimously annoyed as far as I can tell...

 I'm unsatisfied by the work-arounds to make the situation 
 not-suck, but I think I have an idea that would pacify me...

 If we can use `alias this` to mirror an entire C++ namespace 
 into the location we want (ie, the scope immediately outside 
 the C++ namespace!!), then one sanitary line would make the 
 problem quite more tolerable:

 extern(C++, FuckOff)
 {
   void bah();
   void humbug();
 }
 alias this FuckOff;  // <-- symbols are now aliased where they 
 should
 have been all along



 (count the seconds until the reply that says to use reflection 
 to scan the scope, and use a mixin to... blah blah)
After thinking about it for a few minutes I do believe this is a reasonable approach. I am in favor of module-level alias this. The reason name-spaces create a scope is because they are essentially implemented via structs.
May 22 2018
parent Manu <turkeyman gmail.com> writes:
On 22 May 2018 at 20:53, Stefan Koch via Digitalmars-d
<digitalmars-d puremagic.com> wrote:
 On Wednesday, 23 May 2018 at 03:44:36 UTC, Manu wrote:
 Okay, I'm still really angry about the stupid stupid decision to make C++
 namespaces into scopes rather than just a detail used for mangling, with
 absolutely no consultation of the community, in particular the target
 audience, who are unanimously annoyed as far as I can tell...

 I'm unsatisfied by the work-arounds to make the situation not-suck, but I
 think I have an idea that would pacify me...

 If we can use `alias this` to mirror an entire C++ namespace into the
 location we want (ie, the scope immediately outside the C++ namespace!!),
 then one sanitary line would make the problem quite more tolerable:

 extern(C++, FuckOff)
 {
   void bah();
   void humbug();
 }
 alias this FuckOff;  // <-- symbols are now aliased where they should
 have been all along



 (count the seconds until the reply that says to use reflection to scan the
 scope, and use a mixin to... blah blah)
After thinking about it for a few minutes I do believe this is a reasonable approach. I am in favor of module-level alias this. The reason name-spaces create a scope is because they are essentially implemented via structs.
I know, but it shouldn't be... they should just be normal extern(C++) functions with an extra detail in the attribute for mangling.
May 22 2018
prev sibling next sibling parent reply 12345swordy <12345swordy 12345swordy.com> writes:
On Wednesday, 23 May 2018 at 03:44:36 UTC, Manu wrote:
 extern(C++, FuckOff)
 {
   void bah();
   void humbug();
 }
 alias this FuckOff;  // <-- symbols are now aliased where they 
 should
 have been all along
Knock it off with sex talk here.
May 22 2018
parent reply rikki cattermole <rikki cattermole.co.nz> writes:
On 23/05/2018 4:29 PM, 12345swordy wrote:
 On Wednesday, 23 May 2018 at 03:44:36 UTC, Manu wrote:
 extern(C++, FuckOff)
 {
   void bah();
   void humbug();
 }
 alias this FuckOff;  // <-- symbols are now aliased where they should
 have been all along
Knock it off with sex talk here.
This is Manu and he is highly annoyed, you don't need to tell him off.
May 22 2018
parent reply Manu <turkeyman gmail.com> writes:
On 22 May 2018 at 21:31, rikki cattermole via Digitalmars-d
<digitalmars-d puremagic.com> wrote:
 On 23/05/2018 4:29 PM, 12345swordy wrote:
 On Wednesday, 23 May 2018 at 03:44:36 UTC, Manu wrote:
 extern(C++, FuckOff)
 {
   void bah();
   void humbug();
 }
 alias this FuckOff;  // <-- symbols are now aliased where they should
 have been all along
Knock it off with sex talk here.
This is Manu and he is highly annoyed, you don't need to tell him off.
Sure he does! It's a fair call.
May 22 2018
parent reply VectorThis <v v.com> writes:
On Wednesday, 23 May 2018 at 04:38:48 UTC, Manu wrote:
 Sure he does! It's a fair call.
Hey, it could be worse, you could have wrote this below instead.. (then imagine the chaos that would unfold on the D forums) extern(C++, SomethingHere) { void penetration(); void private(); }
May 22 2018
parent reply Manu <turkeyman gmail.com> writes:
On 22 May 2018 at 22:06, VectorThis via Digitalmars-d
<digitalmars-d puremagic.com> wrote:
 On Wednesday, 23 May 2018 at 04:38:48 UTC, Manu wrote:
 Sure he does! It's a fair call.
Hey, it could be worse, you could have wrote this below instead.. (then imagine the chaos that would unfold on the D forums) extern(C++, SomethingHere) { void penetration(); void private(); }
Nar, I didn't mean to start a thing...
May 22 2018
parent reply Steven Schveighoffer <schveiguy yahoo.com> writes:
On 5/23/18 1:49 AM, Manu wrote:
 On 22 May 2018 at 22:06, VectorThis via Digitalmars-d
 <digitalmars-d puremagic.com> wrote:
 On Wednesday, 23 May 2018 at 04:38:48 UTC, Manu wrote:
 Sure he does! It's a fair call.
Hey, it could be worse, you could have wrote this below instead.. (then imagine the chaos that would unfold on the D forums) extern(C++, SomethingHere) { void penetration(); void private(); }
Nar, I didn't mean to start a thing...
I'm just going to warn everyone here that one person is posting as KingJoffrey, VectorThis, Grady Booch, FuckYou, and in this thread he is impersonating 12345swordy, and in others he has impersonated WalterBright as well. -Steve
May 23 2018
next sibling parent reply 12345swordy <alexanderheistermann gmail.com> writes:
On Wednesday, 23 May 2018 at 12:32:50 UTC, Steven Schveighoffer 
wrote:
 On 5/23/18 1:49 AM, Manu wrote:
 On 22 May 2018 at 22:06, VectorThis via Digitalmars-d
 <digitalmars-d puremagic.com> wrote:
 On Wednesday, 23 May 2018 at 04:38:48 UTC, Manu wrote:
 Sure he does! It's a fair call.
Hey, it could be worse, you could have wrote this below instead.. (then imagine the chaos that would unfold on the D forums) extern(C++, SomethingHere) { void penetration(); void private(); }
Nar, I didn't mean to start a thing...
I'm just going to warn everyone here that one person is posting as KingJoffrey, VectorThis, Grady Booch, FuckYou, and in this thread he is impersonating 12345swordy, and in others he has impersonated WalterBright as well. -Steve
No kidding, as I did not write that statement. Can you please support actual web forms to prevent this impersonation?
May 23 2018
parent reply "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Wed, May 23, 2018 at 02:34:07PM +0000, 12345swordy via Digitalmars-d wrote:
[...]
 Can you please support actual web forms to prevent this impersonation?
Unfortunately, "actual" web forums are just as prone to impersonation to someone determined enough. T -- Error: Keyboard not attached. Press F1 to continue. -- Yoon Ha Lee, CONLANG
May 23 2018
next sibling parent reply 12345swordy <alexanderheistermann gmail.com> writes:
On Wednesday, 23 May 2018 at 16:28:22 UTC, H. S. Teoh wrote:
 On Wed, May 23, 2018 at 02:34:07PM +0000, 12345swordy via 
 Digitalmars-d wrote: [...]
 Can you please support actual web forms to prevent this 
 impersonation?
Unfortunately, "actual" web forums are just as prone to impersonation to someone determined enough. T
You can make an argument against security using that logic. Regardless there are many things that a web forum can do that a mailing list can't do.
May 23 2018
next sibling parent Manu <turkeyman gmail.com> writes:
On 23 May 2018 at 10:12, 12345swordy via Digitalmars-d
<digitalmars-d puremagic.com> wrote:
 On Wednesday, 23 May 2018 at 16:28:22 UTC, H. S. Teoh wrote:
 On Wed, May 23, 2018 at 02:34:07PM +0000, 12345swordy via Digitalmars-d
 wrote: [...]
 Can you please support actual web forms to prevent this impersonation?
Unfortunately, "actual" web forums are just as prone to impersonation to someone determined enough. T
You can make an argument against security using that logic. Regardless there are many things that a web forum can do that a mailing list can't do.
One thing a web forum *can't* do, is enjoy my participation. ;) If I have to load a webpage and sign in... I'm out!
May 23 2018
prev sibling parent "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Wed, May 23, 2018 at 10:28:33AM -0700, Manu via Digitalmars-d wrote:
 On 23 May 2018 at 10:12, 12345swordy via Digitalmars-d
 <digitalmars-d puremagic.com> wrote:
[...]
 You can make an argument against security using that logic.
 Regardless there are many things that a web forum can do that a
 mailing list can't do.
One thing a web forum *can't* do, is enjoy my participation. ;) If I have to load a webpage and sign in... I'm out!
While I wouldn't say that I'd be out too, my participation will certainly be much less. But it seems we're in the minority here... T -- The right half of the brain controls the left half of the body. This means that only left-handed people are in their right mind. -- Manoj Srivastava
May 23 2018
prev sibling parent biocyberman <biocyberman gmail.com> writes:
On Wednesday, 23 May 2018 at 16:28:22 UTC, H. S. Teoh wrote:
 On Wed, May 23, 2018 at 02:34:07PM +0000, 12345swordy via 
 Digitalmars-d wrote: [...]
 Can you please support actual web forms to prevent this 
 impersonation?
Unfortunately, "actual" web forums are just as prone to impersonation to someone determined enough. T
That's rather an extreme, not the norm. If something take 3 seconds to do, they may do it; something take more than a minute they may not do it. And it is really easy to impersonate on the current "forum" platform. Anyway, discourse support both worlds of forum and mailing list: https://github.com/discourse/discourse
May 24 2018
prev sibling next sibling parent reply Bastiaan Veelo <Bastiaan Veelo.net> writes:
On Wednesday, 23 May 2018 at 12:32:50 UTC, Steven Schveighoffer 
wrote:
 I'm just going to warn everyone here that one person is posting 
 as KingJoffrey, VectorThis, Grady Booch, FuckYou, and in this 
 thread he is impersonating 12345swordy, and in others he has 
 impersonated WalterBright as well.

 -Steve
Auch! I presume you are able to conclude this from looking at logs etc, thanks for letting us know. I wonder if the post in the name of BjarneStroustrup is from the same person. Impersonation is a criminal offense [1] and should not be joked with. It is also difficult to prevent in general. Impersonation of another forum member is possibly easier to detect. Maybe some sort of message signing could be implemented? Even without impersonation, individuals posting under multiple identities can only have unfair intents (especially in the same thread) and it would be nice if the forum could expose this automatically. It is a shame that this would require someone's time that could well be invested elsewhere, but maybe it's just part of growing pains. [1] https://sharpcriminalattorney.com/internet-crimes/4971/online-impersonation-the-little-brother-of-identity-theft/
May 23 2018
parent reply Steven Schveighoffer <schveiguy yahoo.com> writes:
On 5/23/18 1:19 PM, Bastiaan Veelo wrote:
 On Wednesday, 23 May 2018 at 12:32:50 UTC, Steven Schveighoffer wrote:
 I'm just going to warn everyone here that one person is posting as 
 KingJoffrey, VectorThis, Grady Booch, FuckYou, and in this thread he 
 is impersonating 12345swordy, and in others he has impersonated 
 WalterBright as well.
Auch! I presume you are able to conclude this from looking at logs etc,
The IP address is included in the headers of the newsgroup. All of them came from the same IP. I have a filter on my thunderbird client to flag certain IPs, and his was added to the list recently.
 thanks for letting us know. I wonder if the post in the name of 
 BjarneStroustrup is from the same person.
It was.
 Impersonation is a criminal offense [1] and should not be joked with. It 
 is also difficult to prevent in general. Impersonation of another forum 
 member is possibly easier to detect. Maybe some sort of message signing 
 could be implemented? Even without impersonation, individuals posting 
 under multiple identities can only have unfair intents (especially in 
 the same thread) and it would be nice if the forum could expose this 
 automatically. It is a shame that this would require someone's time that 
 could well be invested elsewhere, but maybe it's just part of growing 
 pains.
I would like to see at least an inability to post with the same exact handle/name as someone who has an account with that name. Or at least put such posts through moderation first. -Steve
May 23 2018
parent reply Dukc <ajieskola gmail.com> writes:
On Wednesday, 23 May 2018 at 17:31:40 UTC, Steven Schveighoffer 
wrote:
 The IP address is included in the headers of the newsgroup. All 
 of them came from the same IP. I have a filter on my 
 thunderbird client to flag certain IPs, and his was added to 
 the list recently.
Then again, it's possible they're family members or neighbours using the same IP. How likely this is, I won't comment. I don't this is a case of inpersonation if you're right, since the aliases have not been trying to inpersonate any real, exact person. But dishonourable action nonetheless.
May 23 2018
next sibling parent rikki cattermole <rikki cattermole.co.nz> writes:
On 24/05/2018 6:32 PM, Dukc wrote:
 On Wednesday, 23 May 2018 at 17:31:40 UTC, Steven Schveighoffer wrote:
 The IP address is included in the headers of the newsgroup. All of 
 them came from the same IP. I have a filter on my thunderbird client 
 to flag certain IPs, and his was added to the list recently.
Then again, it's possible they're family members or neighbours using the same IP. How likely this is, I won't comment.
It's a dynamic IP, so it'll be invalid sooner rather than later.
May 23 2018
prev sibling next sibling parent John Colvin <john.loughran.colvin gmail.com> writes:
On Thursday, 24 May 2018 at 06:32:23 UTC, Dukc wrote:
 On Wednesday, 23 May 2018 at 17:31:40 UTC, Steven Schveighoffer 
 wrote:
 The IP address is included in the headers of the newsgroup. 
 All of them came from the same IP. I have a filter on my 
 thunderbird client to flag certain IPs, and his was added to 
 the list recently.
Then again, it's possible they're family members or neighbours using the same IP. How likely this is, I won't comment. I don't this is a case of inpersonation if you're right, since the aliases have not been trying to inpersonate any real, exact person. But dishonourable action nonetheless.
There was a post impersonating Steven, but I can't see it now so I guess it was removed.
May 24 2018
prev sibling parent Patrick Schluter <Patrick.Schluter bbox.fr> writes:
On Thursday, 24 May 2018 at 06:32:23 UTC, Dukc wrote:
 On Wednesday, 23 May 2018 at 17:31:40 UTC, Steven Schveighoffer 
 wrote:
 The IP address is included in the headers of the newsgroup. 
 All of them came from the same IP. I have a filter on my 
 thunderbird client to flag certain IPs, and his was added to 
 the list recently.
Then again, it's possible they're family members or neighbours using the same IP. How likely this is, I won't comment. I don't this is a case of inpersonation if you're right, since the aliases have not been trying to inpersonate any real, exact person. But dishonourable action nonetheless.
It was quite obvious that KingJoffrey could be the sock puppeteer as he was childish and unreasonable all along the thread about private class members.
May 24 2018
prev sibling parent reply Dukc <ajieskola gmail.com> writes:
On Wednesday, 23 May 2018 at 12:32:50 UTC, Steven Schveighoffer 
wrote:
 and in others he has impersonated WalterBright as well.

 -Steve
Sorry forgot that part in my last post. If that's true, it makes it VERY serious.
May 23 2018
parent reply Jonathan M Davis <newsgroup.d jmdavisprog.com> writes:
On Thursday, May 24, 2018 06:42:21 Dukc via Digitalmars-d wrote:
 On Wednesday, 23 May 2018 at 12:32:50 UTC, Steven Schveighoffer

 wrote:
 and in others he has impersonated WalterBright as well.

 -Steve
Sorry forgot that part in my last post. If that's true, it makes it VERY serious.
It's true. There's at least one post where he posted as WalterBright (note the complete lack of spaces) and tried to make it look like Walter had decided that having private be restricted to the module rather than the class was a mistake. And if the lack of space in the name and the content weren't enough to figure out that it wasn't Walter, the headers made it clear that the post had come from the web forum, and AFAIK, Walter always posts using NNTP. This fellow has impersonated at least half a dozen people in the last couple of days. - Jonathan M Davis
May 24 2018
next sibling parent reply Dukc <ajieskola gmail.com> writes:
On Thursday, 24 May 2018 at 07:07:48 UTC, Jonathan M Davis wrote:

 It's true.
Should somebody of us make an Announce theard out of this?
May 24 2018
parent rikki cattermole <rikki cattermole.co.nz> writes:
On 24/05/2018 7:12 PM, Dukc wrote:
 On Thursday, 24 May 2018 at 07:07:48 UTC, Jonathan M Davis wrote:
 
 It's true.
Should somebody of us make an Announce theard out of this?
No, they are not worth any more of anyone's time.
May 24 2018
prev sibling next sibling parent 12345swordy <alexanderheistermann gmail.com> writes:
On Thursday, 24 May 2018 at 07:07:48 UTC, Jonathan M Davis wrote:
 On Thursday, May 24, 2018 06:42:21 Dukc via Digitalmars-d wrote:
 On Wednesday, 23 May 2018 at 12:32:50 UTC, Steven Schveighoffer

 wrote:
 and in others he has impersonated WalterBright as well.

 -Steve
Sorry forgot that part in my last post. If that's true, it makes it VERY serious.
It's true. There's at least one post where he posted as WalterBright (note the complete lack of spaces) and tried to make it look like Walter had decided that having private be restricted to the module rather than the class was a mistake. And if the lack of space in the name and the content weren't enough to figure out that it wasn't Walter, the headers made it clear that the post had come from the web forum, and AFAIK, Walter always posts using NNTP. This fellow has impersonated at least half a dozen people in the last couple of days. - Jonathan M Davis
That guy show so much salt by doing that.
May 24 2018
prev sibling parent "Nick Sabalausky (Abscissa)" <SeeWebsiteToContactMe semitwist.com> writes:
On 05/24/2018 03:07 AM, Jonathan M Davis wrote:
 
 It's true. There's at least one post where he posted as WalterBright (note
 the complete lack of spaces) and tried to make it look like Walter had
 decided that having private be restricted to the module rather than the
 class was a mistake. And if the lack of space in the name and the content
 weren't enough to figure out that it wasn't Walter, the headers made it
 clear that the post had come from the web forum, and AFAIK, Walter always
 posts using NNTP. This fellow has impersonated at least half a dozen people
 in the last couple of days.
The fake posts are also pretty easy to spot by their writing...*ahem* "style". The people being impersonated don't normally write in a way that sounds like barely-coherent trolling.
May 24 2018
prev sibling next sibling parent Atila Neves <atila.neves gmail.com> writes:
On Wednesday, 23 May 2018 at 03:44:36 UTC, Manu wrote:
 Okay, I'm still really angry about the stupid stupid decision 
 to make C++ namespaces into scopes rather than just a detail 
 used for mangling, with absolutely no consultation of the 
 community, in particular the target audience, who are 
 unanimously annoyed as far as I can tell...
+1 I see no reason for it. It's just mangling after all. Atila
May 23 2018
prev sibling next sibling parent Jonathan Marler <johnnymarler gmail.com> writes:
On Wednesday, 23 May 2018 at 03:44:36 UTC, Manu wrote:
 If we can use `alias this` to mirror an entire C++ namespace 
 into the location we want (ie, the scope immediately outside 
 the C++ namespace!!), then one sanitary line would make the 
 problem quite more tolerable:

 extern(C++, FuckOff)
 {
   void bah();
   void humbug();
 }
 alias this FuckOff;  // <-- symbols are now aliased where they 
 should
 have been all along



 (count the seconds until the reply that says to use reflection 
 to scan the scope, and use a mixin to... blah blah)
Had the same idea about a year ago :) https://forum.dlang.org/post/bmawbtdaqdngoiqfoswo forum.dlang.org
May 23 2018
prev sibling next sibling parent Dukc <ajieskola gmail.com> writes:
On Wednesday, 23 May 2018 at 03:44:36 UTC, Manu wrote:
 alias this ¤%[&Off;  // <-- symbols are now aliased where they
I think it could be with (¤%[&Off): also.
May 23 2018
prev sibling parent Rubn <where is.this> writes:
On Wednesday, 23 May 2018 at 03:44:36 UTC, Manu wrote:
 Okay, I'm still really angry about the stupid stupid decision 
 to make C++ namespaces into scopes rather than just a detail 
 used for mangling, with absolutely no consultation of the 
 community, in particular the target audience, who are 
 unanimously annoyed as far as I can tell...

 I'm unsatisfied by the work-arounds to make the situation 
 not-suck, but I think I have an idea that would pacify me...

 If we can use `alias this` to mirror an entire C++ namespace 
 into the location we want (ie, the scope immediately outside 
 the C++ namespace!!), then one sanitary line would make the 
 problem quite more tolerable:

 extern(C++, FuckOff)
 {
   void bah();
   void humbug();
 }
 alias this FuckOff;  // <-- symbols are now aliased where they 
 should
 have been all along



 (count the seconds until the reply that says to use reflection 
 to scan the scope, and use a mixin to... blah blah)
Would there be any use for this other than working around this problem with extern(C++) ? If not then perhaps changing the behavior to be what is desired would be better. If we change extern(C++, Namespace) to work only for mangling and not as a struct, then existing code would only need to create a new module with "Namespace" and statically import it to work with existing code. I'd rather the actual problem be fixed than having some work around for it. We don't even have multiple "alias this" in structs. If a new feature were to be added I'd rather it'd be that, which was "approved" but has yet to be included.
May 24 2018