Re: D's Newfangled Name Mangling

2017-12-22 Thread Joakim via Digitalmars-d-announce
On Friday, 22 December 2017 at 14:34:56 UTC, Andrei Alexandrescu 
wrote:

On 12/20/17 8:57 AM, Mike Parker wrote:
Many thanks to Rainer for his insightful new article for the D 
Blog outlining the new name mangling algorithm. He talks about 
the old implementation and its limitations before going into 
the details of the new one. It's a topic I had never 
considered digging into before, even when the big Voldemort 
issue first popped up, but now I find it interesting.


The blog
https://dlang.org/blog/2017/12/20/ds-newfangled-name-mangling/

Reddit
https://www.reddit.com/r/programming/comments/7l1h36/ds_newfangled_name_mangling/


Hi folks, the discussion in the announce forum is most welcome 
but statistically very few people read the forum. Please direct 
discussions to the reddit group, which enjoys a broader 
audience. Sadly right now the sparse reddit discussion makes 
the reception look worse than it actually was. -- Andrei


We mostly just post corrections and technical suggestions in 
here, which are more likely to be seen.  Anyway, the post has 
already done well on proggit, made top 25 most-liked of the last 
week and top 10 dlang.org posts of the last year:


https://www.reddit.com/r/programming/top/?sort=top=week
https://www.reddit.com/domain/dlang.org/top/?sort=top=year


Re: D's Newfangled Name Mangling

2017-12-22 Thread Andrei Alexandrescu via Digitalmars-d-announce

On 12/20/17 8:57 AM, Mike Parker wrote:
Many thanks to Rainer for his insightful new article for the D Blog 
outlining the new name mangling algorithm. He talks about the old 
implementation and its limitations before going into the details of the 
new one. It's a topic I had never considered digging into before, even 
when the big Voldemort issue first popped up, but now I find it 
interesting.


The blog
https://dlang.org/blog/2017/12/20/ds-newfangled-name-mangling/

Reddit
https://www.reddit.com/r/programming/comments/7l1h36/ds_newfangled_name_mangling/ 


Hi folks, the discussion in the announce forum is most welcome but 
statistically very few people read the forum. Please direct discussions 
to the reddit group, which enjoys a broader audience. Sadly right now 
the sparse reddit discussion makes the reception look worse than it 
actually was. -- Andrei


Re: D's Newfangled Name Mangling

2017-12-22 Thread Joakim via Digitalmars-d-announce

On Thursday, 21 December 2017 at 06:53:35 UTC, Mike Parker wrote:
On Wednesday, 20 December 2017 at 19:16:03 UTC, Ali Çehreli 
wrote:

On 12/20/2017 07:41 AM, David Gileadi wrote:




Typo: "This is were I stepped in..." -> "..where.."


Yeah, an excellent post. Strangely, I could find just one typo 
myself. :)


Its rather simple ->
It's rather simple



Thanks, guys!


Still making my way through this long post, but

that make this information accessible faster -> that make 
accessing this information faster


Re: D's Newfangled Name Mangling

2017-12-21 Thread ketmar via Digitalmars-d-announce

Andrej Mitrovic wrote:

ah, 'cmon, we can hash the whole source file! let's move build system's 
work to linker! ;-)


sorry, but this is really overkill. tracking changed files and rebuilding 
'em on demand is something your build system should do.


Re: D's Newfangled Name Mangling

2017-12-21 Thread Andrej Mitrovic via Digitalmars-d-announce

On Wednesday, 20 December 2017 at 13:57:20 UTC, Mike Parker wrote:

The blog
https://dlang.org/blog/2017/12/20/ds-newfangled-name-mangling/


it won’t catch every error; for example, structs, classes and 
other user defined types are mangled > by name only, so that a 
change to their definition will still pass unnoticed by the 
linker.


Wouldn't it be possible to append the hash of the struct's type 
definition to make the changes to the struct's definition 
noticeable during linking?


e.g.:

-
module test;

struct S
{
int x;
float y;
}

void foo ( S s ) { }
-

You might create a hash this way:

hash = Fnv1a(mangle(Tint32), mangle(Tfloat32));

And then foo's name mangle changes from:
_D4test3fooFS4test1SZv

to:
_D4test3fooFS4test1SZv

It may not be 100% fool-proof yet though, because we'd also have 
to hash a bunch of other things like align() attributes.


Or is this is overkill?


Re: D's Newfangled Name Mangling

2017-12-21 Thread Rainer Schuetze via Digitalmars-d-announce



On 20.12.2017 19:42, Johan Engelen wrote:

On Wednesday, 20 December 2017 at 13:57:20 UTC, Mike Parker wrote:
Many thanks to Rainer for his insightful new article for the D Blog 
outlining the new name mangling algorithm.


Nice!


Thanks.



"D and C++ avoid this problem by adding more information to the symbol 
name, i.e. they encode into a symbol name the scope in which the symbol 
is defined, the function argument types, and the return type. "


I would change it to "... and the return type (D only)". C++ does not 
include the return type in the mangle for normal functions (it does for 
templates). An important difference, concerning the earlier remark about 
programs crashing when "fail to update and recompile all source files 
that use the new declarartion"


AFAICT that's for the Itanium C++ ABI only, the VC mangling always 
encodes the return type, too.


I also noticed that gcc doesn't encode the inferred type of an "auto" 
return type for templates (available with C++17; or was it in C++14 
already?).


Re: D's Newfangled Name Mangling

2017-12-20 Thread Mike Parker via Digitalmars-d-announce

On Wednesday, 20 December 2017 at 19:16:03 UTC, Ali Çehreli wrote:

On 12/20/2017 07:41 AM, David Gileadi wrote:




Typo: "This is were I stepped in..." -> "..where.."


Yeah, an excellent post. Strangely, I could find just one typo 
myself. :)


Its rather simple ->
It's rather simple



Thanks, guys!



Re: D's Newfangled Name Mangling

2017-12-20 Thread Ali Çehreli via Digitalmars-d-announce

On 12/20/2017 07:41 AM, David Gileadi wrote:

On 12/20/17 6:57 AM, Mike Parker wrote:
Many thanks to Rainer for his insightful new article for the D Blog 
outlining the new name mangling algorithm. He talks about the old 
implementation and its limitations before going into the details of 
the new one. It's a topic I had never considered digging into before, 
even when the big Voldemort issue first popped up, but now I find it 
interesting.


The blog
https://dlang.org/blog/2017/12/20/ds-newfangled-name-mangling/

Reddit
https://www.reddit.com/r/programming/comments/7l1h36/ds_newfangled_name_mangling/ 



I really enjoyed this!

Typo: "This is were I stepped in..." -> "..where.."


Yeah, an excellent post. Strangely, I could find just one typo myself. :)

Its rather simple ->
It's rather simple

Ali


Re: D's Newfangled Name Mangling

2017-12-20 Thread Johan Engelen via Digitalmars-d-announce

On Wednesday, 20 December 2017 at 13:57:20 UTC, Mike Parker wrote:
Many thanks to Rainer for his insightful new article for the D 
Blog outlining the new name mangling algorithm.


Nice!

"D and C++ avoid this problem by adding more information to the 
symbol name, i.e. they encode into a symbol name the scope in 
which the symbol is defined, the function argument types, and the 
return type. "


I would change it to "... and the return type (D only)". C++ does 
not include the return type in the mangle for normal functions 
(it does for templates). An important difference, concerning the 
earlier remark about programs crashing when "fail to update and 
recompile all source files that use the new declarartion"


-Johan



Re: D's Newfangled Name Mangling

2017-12-20 Thread David Gileadi via Digitalmars-d-announce

On 12/20/17 6:57 AM, Mike Parker wrote:
Many thanks to Rainer for his insightful new article for the D Blog 
outlining the new name mangling algorithm. He talks about the old 
implementation and its limitations before going into the details of the 
new one. It's a topic I had never considered digging into before, even 
when the big Voldemort issue first popped up, but now I find it 
interesting.


The blog
https://dlang.org/blog/2017/12/20/ds-newfangled-name-mangling/

Reddit
https://www.reddit.com/r/programming/comments/7l1h36/ds_newfangled_name_mangling/ 


I really enjoyed this!

Typo: "This is were I stepped in..." -> "..where.."