Re: [OT] My C++ talk at GoingNative 2013

2013-09-21 Thread Nick Sabalausky
On Fri, 20 Sep 2013 10:50:23 -0700
Andrei Alexandrescu seewebsiteforem...@erdani.org wrote:

 On 9/19/13 3:56 PM, Justin Whear wrote:
 
  Yessir: http://imgur.com/W5AMy0P
 
 Awesome. My coworkers added that to our panoply of visual comments in 
 our review tool (Phabricator).
 
 Now any code reviewer could insert the word skeptical to insert
 that image in a review. Fits how I feel about some code, notably my
 own :o).
 

That's just awesome :)



Re: [OT] My C++ talk at GoingNative 2013

2013-09-21 Thread Ali Çehreli

On 09/09/2013 09:43 AM, Andrei Alexandrescu wrote:

http://www.reddit.com/r/programming/comments/1m1izv/goingnative_2013_writing_quick_code_in_c_quickly/


Andrei


Great talk indeed!

I am late to the party so instead of commenting on Reddit I will write here.

There are two points made in the talk that favor out parameters over 
return-by-value:


quote
Slide 33/40:

The Composability Argument

* Appending to containers: cheap

* Concatenating containers: expensive

Slide 34/40

The Measurements Argument

* Which one is faster?

// API 1: Returns next line (with terminator)
// or empty string at end of file
string nextLine(istream);

// API 2: Fills string with next line (with terminator)
// returns false at end of file
bool nextLine(istream, string s);
/quote

This topic happens to be one of my favorite interview questions. :)

If program correctness is valued, the by-ref out parameter may not be 
the faster option because the caller may not want to pass in a precious 
container to a function only to be halfway appended to it.


Imagine that the function appends N/2 items to the caller's container 
and then throws. If that half-baked state is not desired, either the 
function itself or the caller may have to undo what has already been 
appended.


If the function should not append but first clear the container and 
then create it anew, then fair enough, we would be taking advantage of 
already-allocated buffer of the container. (A valid consideration for 
arrays but not every pointer-based data structure takes advantage of old 
buffers.) But still, for correctness, the function should not append but 
create anew (on top of the existing buffer), which necessitates 
concatenation on the caller side anyway.


Ali



Re: [OT] My C++ talk at GoingNative 2013

2013-09-20 Thread Olivier Pisano
On Thursday, 19 September 2013 at 22:56:55 UTC, Justin Whear 
wrote:

On Thu, 19 Sep 2013 14:31:28 -0700, Walter Bright wrote:

Yessir: http://imgur.com/W5AMy0P


Thank you so much!


Re: [OT] My C++ talk at GoingNative 2013

2013-09-20 Thread Justin Whear
On Thu, 19 Sep 2013 22:56:55 +, Justin Whear wrote:

 On Thu, 19 Sep 2013 14:31:28 -0700, Walter Bright wrote:
 
 On 9/18/2013 1:23 AM, Olivier Pisano wrote:
 
 Classic Andrei! :-)
 
 Should zoom in on that and make a gif!
 
 Yessir: http://imgur.com/W5AMy0P

I think I'm going to start posting simply this in response to any 
statement that I find dubious.


Re: [OT] My C++ talk at GoingNative 2013

2013-09-20 Thread Tobias Pankrath

On Friday, 20 September 2013 at 15:52:35 UTC, Justin Whear wrote:

On Thu, 19 Sep 2013 22:56:55 +, Justin Whear wrote:


On Thu, 19 Sep 2013 14:31:28 -0700, Walter Bright wrote:


On 9/18/2013 1:23 AM, Olivier Pisano wrote:

Classic Andrei! :-)

Should zoom in on that and make a gif!


Yessir: http://imgur.com/W5AMy0P


I think I'm going to start posting simply this in response to 
any

statement that I find dubious.


It has quite some meme potential ^^


Re: [OT] My C++ talk at GoingNative 2013

2013-09-20 Thread Andrei Alexandrescu

On 9/19/13 3:56 PM, Justin Whear wrote:

On Thu, 19 Sep 2013 14:31:28 -0700, Walter Bright wrote:


On 9/18/2013 1:23 AM, Olivier Pisano wrote:

On Friday, 13 September 2013 at 06:51:52 UTC, deadalnix wrote:


There is 2 ask us anything. Can you tell us which one and
approximately when ?


Yes, the first one (
http://channel9.msdn.com/Events/GoingNative/2013/Interactive-Panel-Ask-

Us-Anything

) around 01:14:20.


Classic Andrei! :-)

Should zoom in on that and make a gif!


Yessir: http://imgur.com/W5AMy0P


Awesome. My coworkers added that to our panoply of visual comments in 
our review tool (Phabricator).


Now any code reviewer could insert the word skeptical to insert that 
image in a review. Fits how I feel about some code, notably my own :o).


Thanks!

Andrei


Re: [OT] My C++ talk at GoingNative 2013

2013-09-19 Thread Walter Bright

On 9/18/2013 1:23 AM, Olivier Pisano wrote:

On Friday, 13 September 2013 at 06:51:52 UTC, deadalnix wrote:


There is 2 ask us anything. Can you tell us which one and approximately when ?


Yes, the first one (
http://channel9.msdn.com/Events/GoingNative/2013/Interactive-Panel-Ask-Us-Anything
) around 01:14:20.


Classic Andrei! :-)

Should zoom in on that and make a gif!


Re: [OT] My C++ talk at GoingNative 2013

2013-09-18 Thread Olivier Pisano

On Friday, 13 September 2013 at 06:51:52 UTC, deadalnix wrote:


There is 2 ask us anything. Can you tell us which one and 
approximately when ?


Yes, the first one ( 
http://channel9.msdn.com/Events/GoingNative/2013/Interactive-Panel-Ask-Us-Anything 
) around 01:14:20.


Re: [OT] My C++ talk at GoingNative 2013

2013-09-18 Thread growler
On Monday, 9 September 2013 at 16:43:54 UTC, Andrei Alexandrescu 
wrote:

http://www.reddit.com/r/programming/comments/1m1izv/goingnative_2013_writing_quick_code_in_c_quickly/

Andrei


Just wanted to say thanks for posting the link, it was a great 
talk.


Of the other talks I especially enjoyed those by the backend VC 
compiler guys, Compiler++ and Compiler Confidential.


Watching your second talk on tuples I couldn't help thinking how 
much easier templates are in D. When reading C++ I find I have to 
make a context switch between run-time and compile-time thinking. 
It's quite jarring. In D, however, templates come naturally and 
it's very seamless.





Re: [OT] My C++ talk at GoingNative 2013

2013-09-18 Thread Gary Willoughby

On Wednesday, 18 September 2013 at 10:18:43 UTC, growler wrote:
Watching your second talk on tuples I couldn't help thinking 
how much easier templates are in D. When reading C++ I find I 
have to make a context switch between run-time and compile-time 
thinking. It's quite jarring. In D, however, templates come 
naturally and it's very seamless.


This is how i feel too, templates in D are an absolute joy to use 
and so natural!


Re: [OT] My C++ talk at GoingNative 2013

2013-09-14 Thread Jacob Carlborg

On 2013-09-13 09:40, Mathias LANG wrote:


It may be a trend, but I hope it will never become D's official
approach, because it doesn't scale. This would left out all the
people that use the object-file based approach (and related
tools, like Makefiles), which is dominant in the Linux world, and
is required in some cases (limited hardware, distributed
compiling, or simply huge projects).


D supports separate compilation, object files and libraries. I don't 
think it will ever stop supporting that.


--
/Jacob Carlborg


Re: [OT] My C++ talk at GoingNative 2013

2013-09-13 Thread Jacob Carlborg

On 2013-09-10 14:54, Olivier Grant wrote:

First of all, I very much enjoyed the talk. It was as interesting as it
was entertaining.


Yes, I enjoyed it as well.


I do have a question regarding the talk's section on devirtualization.
As a language that imposes virtual methods for classes, how well does D
play when it comes to devirtualization? And on a side note, does D have
a different way of implementing virtual methods than most C++ compilers do?


In D it seems that currently the preferred way to compile a project is 
to compile all the source at once using RDMD or similar. Isn't that a 
great opportunity for full program analysis to do devirtualization?


--
/Jacob Carlborg


Re: [OT] My C++ talk at GoingNative 2013

2013-09-13 Thread deadalnix
On Friday, 13 September 2013 at 06:24:26 UTC, Jacob Carlborg 
wrote:

On 2013-09-10 14:54, Olivier Grant wrote:
First of all, I very much enjoyed the talk. It was as 
interesting as it

was entertaining.


Yes, I enjoyed it as well.

I do have a question regarding the talk's section on 
devirtualization.
As a language that imposes virtual methods for classes, how 
well does D
play when it comes to devirtualization? And on a side note, 
does D have
a different way of implementing virtual methods than most C++ 
compilers do?


In D it seems that currently the preferred way to compile a 
project is to compile all the source at once using RDMD or 
similar. Isn't that a great opportunity for full program 
analysis to do devirtualization?


No because export is ill defined. But it definitively should.


Re: [OT] My C++ talk at GoingNative 2013

2013-09-13 Thread deadalnix
On Wednesday, 11 September 2013 at 05:27:35 UTC, Olivier Pisano 
wrote:
On Monday, 9 September 2013 at 16:43:54 UTC, Andrei 
Alexandrescu wrote:

http://www.reddit.com/r/programming/comments/1m1izv/goingnative_2013_writing_quick_code_in_c_quickly/

Andrei


This talks are amazing. I learned a lot. Thank you all guys for 
your dedication and pedagogy.


BTW, I really liked your face during the 'Ask us anything' 
panel, when STL talked about Garbage Collection!




There is 2 ask us anything. Can you tell us which one and 
approximately when ?


Re: [OT] My C++ talk at GoingNative 2013

2013-09-13 Thread Mathias LANG
I do have a question regarding the talk's section on 
devirtualization.
As a language that imposes virtual methods for classes, how 
well does D
play when it comes to devirtualization? And on a side note, 
does D have
a different way of implementing virtual methods than most C++ 
compilers do?


In D it seems that currently the preferred way to compile a 
project is to compile all the source at once using RDMD or 
similar. Isn't that a great opportunity for full program 
analysis to do devirtualization?



It may be a trend, but I hope it will never become D's official
approach, because it doesn't scale. This would left out all the
people that use the object-file based approach (and related
tools, like Makefiles), which is dominant in the Linux world, and
is required in some cases (limited hardware, distributed
compiling, or simply huge projects).


Re: [OT] My C++ talk at GoingNative 2013

2013-09-12 Thread Joseph Rushton Wakeling

On Tuesday, 10 September 2013 at 13:08:29 UTC, Iain Buclaw wrote:
All class methods are virtual by default in D, unless declared 
'final'.


There was an intense discussion a while back which ended in (I 
think) a decision by Walter to switch to final-by-default, but 
there has so far been no practical follow-up.


Re: [OT] My C++ talk at GoingNative 2013

2013-09-12 Thread Iain Buclaw
On Sep 12, 2013 9:16 PM, Joseph Rushton Wakeling 
joseph.wakel...@webdrake.net wrote:

 On Tuesday, 10 September 2013 at 13:08:29 UTC, Iain Buclaw wrote:

 All class methods are virtual by default in D, unless declared 'final'.


 There was an intense discussion a while back which ended in (I think) a
decision by Walter to switch to final-by-default, but there has so far been
no practical follow-up.

Not sure how long ago that was, but dconf everyone agreed to disagree and
left it at we're not changing it.

Regards
-- 
Iain Buclaw

*(p  e ? p++ : p) = (c  0x0f) + '0';


Re: [OT] My C++ talk at GoingNative 2013

2013-09-12 Thread Sean Kelly
On Sep 12, 2013, at 2:46 PM, Iain Buclaw ibuc...@ubuntu.com wrote:
 
 Not sure how long ago that was, but dconf everyone agreed to disagree and 
 left it at we're not changing it.

Here's a portion of the discussion where Walter seemed to change his mind:

http://forum.dlang.org/thread/yzsqwejxqlnzryhrk...@forum.dlang.org?page=26

Re: [OT] My C++ talk at GoingNative 2013

2013-09-12 Thread Sean Kelly
On Sep 12, 2013, at 2:46 PM, Iain Buclaw ibuc...@ubuntu.com wrote:

 
 On Sep 12, 2013 9:16 PM, Joseph Rushton Wakeling 
 joseph.wakel...@webdrake.net wrote:
 
  On Tuesday, 10 September 2013 at 13:08:29 UTC, Iain Buclaw wrote:
 
  All class methods are virtual by default in D, unless declared 'final'.
 
 
  There was an intense discussion a while back which ended in (I think) a 
  decision by Walter to switch to final-by-default, but there has so far been 
  no practical follow-up.
 
 Not sure how long ago that was, but dconf everyone agreed to disagree and 
 left it at we're not changing it.

I believe this decision happened after dconf as the result of a rather long 
discussion in digitalmars.D.  Someone referenced something written by a C# 
creator.

Re: [OT] My C++ talk at GoingNative 2013

2013-09-10 Thread deadalnix
On Monday, 9 September 2013 at 16:43:54 UTC, Andrei Alexandrescu 
wrote:

http://www.reddit.com/r/programming/comments/1m1izv/goingnative_2013_writing_quick_code_in_c_quickly/

Andrei


So I'll jump in as I've seen the conf before that post.

It is really worthwhile to watch. Quite informative on the 
technical side (funilly, I did implement the solution presented 
in the devirtualization part on a platform where virtual function 
were not available because of crappy compiler, but had no idea it 
was worthwhile for speed, it wasn't the goal so I never measured, 
and it also may not the case on the given plateform).


Many discussed subject apply as well to D. By the way, what is 
the state of std.bitmanip in comparison to what is presented in 
the conf ?


Also, Andrei, did you try LLVM/clang ?

Related to going native, Chandler the discussion on signess of 
integers and I really wonder if we should follow the rule that 
make unsigned spread like a virus, as C does.


Re: [OT] My C++ talk at GoingNative 2013

2013-09-10 Thread Olivier Grant
First of all, I very much enjoyed the talk. It was as interesting 
as it was entertaining.


I do have a question regarding the talk's section on 
devirtualization. As a language that imposes virtual methods for 
classes, how well does D play when it comes to devirtualization? 
And on a side note, does D have a different way of implementing 
virtual methods than most C++ compilers do?


Thanks,

O.

On Monday, 9 September 2013 at 16:43:54 UTC, Andrei Alexandrescu 
wrote:

http://www.reddit.com/r/programming/comments/1m1izv/goingnative_2013_writing_quick_code_in_c_quickly/

Andrei




Re: [OT] My C++ talk at GoingNative 2013

2013-09-10 Thread Iain Buclaw
On 10 September 2013 13:54, Olivier Grant olivier.gr...@gmail.com wrote:
 First of all, I very much enjoyed the talk. It was as interesting as it was
 entertaining.

 I do have a question regarding the talk's section on devirtualization. As a
 language that imposes virtual methods for classes, how well does D play when
 it comes to devirtualization? And on a side note, does D have a different
 way of implementing virtual methods than most C++ compilers do?


All class methods are virtual by default in D, unless declared 'final'.

Devirtualisation is not something done by the front-end, but recent
updates and interest from compiler back-ends may provide a solution.

-- 
Iain Buclaw

*(p  e ? p++ : p) = (c  0x0f) + '0';


Re: [OT] My C++ talk at GoingNative 2013

2013-09-10 Thread Iain Buclaw
On 10 September 2013 11:10, deadalnix deadal...@gmail.com wrote:
 On Monday, 9 September 2013 at 16:43:54 UTC, Andrei Alexandrescu wrote:


 http://www.reddit.com/r/programming/comments/1m1izv/goingnative_2013_writing_quick_code_in_c_quickly/

 Andrei


 So I'll jump in as I've seen the conf before that post.

 It is really worthwhile to watch. Quite informative on the technical side
 (funilly, I did implement the solution presented in the devirtualization
 part on a platform where virtual function were not available because of
 crappy compiler, but had no idea it was worthwhile for speed, it wasn't the
 goal so I never measured, and it also may not the case on the given
 plateform).


Interestingly enough, gcc recently added (about a month before Andrei
did the talk) a new interprocedural analysis pass that sets all
methods that can be devirtualised.  I expect that LLVM have something
cooking up for this too.  As of yet, I haven't ran any tests which
show that this works though...


-- 
Iain Buclaw

*(p  e ? p++ : p) = (c  0x0f) + '0';


Re: [OT] My C++ talk at GoingNative 2013

2013-09-10 Thread PauloPinto

On Tuesday, 10 September 2013 at 13:20:18 UTC, Iain Buclaw wrote:
On 10 September 2013 11:10, deadalnix deadal...@gmail.com 
wrote:
On Monday, 9 September 2013 at 16:43:54 UTC, Andrei 
Alexandrescu wrote:



http://www.reddit.com/r/programming/comments/1m1izv/goingnative_2013_writing_quick_code_in_c_quickly/

Andrei



So I'll jump in as I've seen the conf before that post.

It is really worthwhile to watch. Quite informative on the 
technical side
(funilly, I did implement the solution presented in the 
devirtualization
part on a platform where virtual function were not available 
because of
crappy compiler, but had no idea it was worthwhile for speed, 
it wasn't the
goal so I never measured, and it also may not the case on the 
given

plateform).



Interestingly enough, gcc recently added (about a month before 
Andrei

did the talk) a new interprocedural analysis pass that sets all
methods that can be devirtualised.  I expect that LLVM have 
something
cooking up for this too.  As of yet, I haven't ran any tests 
which

show that this works though...


The main problem with devirtualization is that you can only have 
full benefits when targeting VM based environments.


With native generated code, it is only possible to apply 
devirtualization on static linked code.


--
Paulo


Re: [OT] My C++ talk at GoingNative 2013

2013-09-10 Thread Olivier Pisano
On Monday, 9 September 2013 at 16:43:54 UTC, Andrei Alexandrescu 
wrote:

http://www.reddit.com/r/programming/comments/1m1izv/goingnative_2013_writing_quick_code_in_c_quickly/

Andrei


This talks are amazing. I learned a lot. Thank you all guys for 
your dedication and pedagogy.


BTW, I really liked your face during the 'Ask us anything' panel, 
when STL talked about Garbage Collection!


Congratulations for resisting the need to shout 'D does already 
solves this problem' at least a dozen of times. Too bad Native 
means C++ in Microsoft speak.


[OT] My C++ talk at GoingNative 2013

2013-09-09 Thread Andrei Alexandrescu

http://www.reddit.com/r/programming/comments/1m1izv/goingnative_2013_writing_quick_code_in_c_quickly/

Andrei


Re: GoingNative 2013

2013-08-25 Thread Adam Wilson

On Sun, 25 Aug 2013 13:41:00 -0700, Adam Wilson flybo...@gmail.com wrote:

On Mon, 29 Jul 2013 15:12:39 -0700, Walter Bright  
newshou...@digitalmars.com wrote:



http://channel9.msdn.com/Events/GoingNative/2013

The last one was a lot of fun, so I signed up for this one, too. Note  
that Andrei is a speaker! Recommended. See y'all there!


(P.S. It's entirely possible that I may get my mythical '72 Dodge  
running in time for this, and I can drive it to the conference. It  
blarts out enough CO2 to melt at least 3 Priuses.)


It looks like I'll be there! I was able to beg the time off. The ability  
to connect to the WiFi and the sweet setup they have for laptops there  
was what got my boss to agree. :-)




Also looking forward to heckling Andrei! ;-)

--
Adam Wilson
IRC: LightBender
Project Coordinator
The Horizon Project
http://www.thehorizonproject.org/


Re: GoingNative 2013

2013-08-25 Thread Adam Wilson
On Mon, 29 Jul 2013 15:12:39 -0700, Walter Bright  
newshou...@digitalmars.com wrote:



http://channel9.msdn.com/Events/GoingNative/2013

The last one was a lot of fun, so I signed up for this one, too. Note  
that Andrei is a speaker! Recommended. See y'all there!


(P.S. It's entirely possible that I may get my mythical '72 Dodge  
running in time for this, and I can drive it to the conference. It  
blarts out enough CO2 to melt at least 3 Priuses.)


It looks like I'll be there! I was able to beg the time off. The ability  
to connect to the WiFi and the sweet setup they have for laptops there was  
what got my boss to agree. :-)


--
Adam Wilson
IRC: LightBender
Project Coordinator
The Horizon Project
http://www.thehorizonproject.org/


Re: GoingNative 2013

2013-07-30 Thread Walter Bright

On 7/30/2013 1:14 PM, Adam Wilson wrote:

Since I've never been before, I would like to know if there is a place that I
can setup a laptop in the lecture hall. I *really* want to go to this, but I
have product launch two weeks prior at VSLive (also at MSFT) and it may need
emergency support.



Most people there seem to have laptops and use them, so I doubt this would be an 
issue.


Re: GoingNative 2013

2013-07-30 Thread Andrei Alexandrescu

On 7/30/13 1:14 PM, Adam Wilson wrote:

On Mon, 29 Jul 2013 15:12:39 -0700, Walter Bright
newshou...@digitalmars.com wrote:


http://channel9.msdn.com/Events/GoingNative/2013

The last one was a lot of fun, so I signed up for this one, too. Note
that Andrei is a speaker! Recommended. See y'all there!

(P.S. It's entirely possible that I may get my mythical '72 Dodge
running in time for this, and I can drive it to the conference. It
blarts out enough CO2 to melt at least 3 Priuses.)


Since I've never been before, I would like to know if there is a place
that I can setup a laptop in the lecture hall. I *really* want to go to
this, but I have product launch two weeks prior at VSLive (also at MSFT)
and it may need emergency support.


Yah, you can.

Andrei


Re: GoingNative 2013

2013-07-29 Thread Brad Anderson

On Monday, 29 July 2013 at 22:12:40 UTC, Walter Bright wrote:

http://channel9.msdn.com/Events/GoingNative/2013

The last one was a lot of fun, so I signed up for this one, 
too. Note that Andrei is a speaker! Recommended. See y'all 
there!


(P.S. It's entirely possible that I may get my mythical '72 
Dodge running in time for this, and I can drive it to the 
conference. It blarts out enough CO2 to melt at least 3 
Priuses.)


They said they may not live stream it this year like they did 
last year.  That's a shame because it was a lot of fun heckling 
Andrei in #d :P.


Re: GoingNative 2013

2013-07-29 Thread Manu
On 30 July 2013 08:12, Walter Bright newshou...@digitalmars.com wrote:

 http://channel9.msdn.com/**Events/GoingNative/2013http://channel9.msdn.com/Events/GoingNative/2013

 The last one was a lot of fun, so I signed up for this one, too. Note that
 Andrei is a speaker! Recommended. See y'all there!

 (P.S. It's entirely possible that I may get my mythical '72 Dodge running
 in time for this, and I can drive it to the conference. It blarts out
 enough CO2 to melt at least 3 Priuses.)


On a possibly related note, the north pole is actually a lake this
summer... (mouse-swipe the picture left)
http://www.huffingtonpost.com/2013/07/25/north-pole-melting-leaves_n_3652373.html


Re: GoingNative 2013

2013-07-29 Thread Walter Bright

On 7/29/2013 7:25 PM, Manu wrote:

On 30 July 2013 08:12, Walter Bright newshou...@digitalmars.com
mailto:newshou...@digitalmars.com wrote:

http://channel9.msdn.com/__Events/GoingNative/2013
http://channel9.msdn.com/Events/GoingNative/2013

The last one was a lot of fun, so I signed up for this one, too. Note that
Andrei is a speaker! Recommended. See y'all there!

(P.S. It's entirely possible that I may get my mythical '72 Dodge running in
time for this, and I can drive it to the conference. It blarts out enough
CO2 to melt at least 3 Priuses.)


On a possibly related note, the north pole is actually a lake this summer...
(mouse-swipe the picture left)
http://www.huffingtonpost.com/2013/07/25/north-pole-melting-leaves_n_3652373.html


Not my fault, I've put maybe 6 miles on the car in 25 years!