www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - Higgs, a JavaScript JIT done in D

reply Paulo Pinto <pjmlp progtools.org> writes:
I just saw this talk:

Higgs, a Monitoring JIT for JavaScript & Metacircular VM Layering

https://air.mozilla.org/higgs-jit/

Maxime is using D to implement her JIT.

More information on her blog,

http://pointersgonewild.wordpress.com/2013/01/31/visiting-mozilla/

Source code is available at GitHub,

https://github.com/maximecb/Higgs

Nice to see projects that we can use as real life examples of D usage. :)

--
Paulo
Feb 02 2013
next sibling parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 2/3/13 2:46 AM, Paulo Pinto wrote:
 I just saw this talk:

 Higgs, a Monitoring JIT for JavaScript & Metacircular VM Layering

 https://air.mozilla.org/higgs-jit/

 Maxime is using D to implement her JIT.

 More information on her blog,

 http://pointersgonewild.wordpress.com/2013/01/31/visiting-mozilla/

 Source code is available at GitHub,

 https://github.com/maximecb/Higgs

 Nice to see projects that we can use as real life examples of D usage. :)

 --
 Paulo
http://www.reddit.com/r/programming/comments/17resr/higgs_a_monitoring_jit_for_javascript/ Andrei
Feb 03 2013
prev sibling next sibling parent reply "bearophile" <bearophileHUGS lycos.com> writes:
Paulo Pinto:

 Source code is available at GitHub,

 https://github.com/maximecb/Higgs
The code seems to miss the usage of contracts, foreach loops on numerical intervals, final switch, toString with sink, text() function, enum for compile-time constants, most const arguments, const on methods. Generally when you see several projects with the same "utility", it often means it should be in Phobos. So maybe something like this should be in Phobos: https://github.com/maximecb/Higgs/blob/master/source/util/misc.d Bye, bearophile
Feb 03 2013
parent reply "deadalnix" <deadalnix gmail.com> writes:
On Sunday, 3 February 2013 at 11:26:54 UTC, bearophile wrote:
 Paulo Pinto:

 Source code is available at GitHub,

 https://github.com/maximecb/Higgs
The code seems to miss the usage of contracts, foreach loops on numerical intervals, final switch, toString with sink, text() function, enum for compile-time constants, most const arguments, const on methods.
My experience tells me that this is probably a good idea if you don't want to run into weirdland.
Feb 03 2013
parent reply "bearophile" <bearophileHUGS lycos.com> writes:
deadalnix:

 The code seems to miss the usage of contracts, foreach loops 
 on numerical intervals, final switch, toString with sink, 
 text() function, enum for compile-time constants, most const 
 arguments, const on methods.
My experience tells me that this is probably a good idea if you don't want to run into weirdland.
Among those things I have listed, probably the only ones that give a little of troubles are const on methods. The author has used asserts at the beginning of methods, outside a the pre-condition, this is silly. Not using foreach loops on numerical intervals is a waste of fingers and increases the risk of mistakes, final switches often help you, text() is shorter than to!string(), const arguments are usually handy to avoid some troubles and make function/method signatures more informative. Bye, bearophile
Feb 03 2013
next sibling parent reply "Dejan Lekic" <dejan.lekic gmail.com> writes:
On Sunday, 3 February 2013 at 13:56:13 UTC, bearophile wrote:
 deadalnix:

 The code seems to miss the usage of contracts, foreach loops 
 on numerical intervals, final switch, toString with sink, 
 text() function, enum for compile-time constants, most const 
 arguments, const on methods.
My experience tells me that this is probably a good idea if you don't want to run into weirdland.
Among those things I have listed, probably the only ones that give a little of troubles are const on methods. The author has used asserts at the beginning of methods, outside a the pre-condition, this is silly. Not using foreach loops on numerical intervals is a waste of fingers and increases the risk of mistakes, final switches often help you, text() is shorter than to!string(), const arguments are usually handy to avoid some troubles and make function/method signatures more informative. Bye, bearophile
Welcome to reality Bearophile!!! In real projects people do the job as best as they can at the moment, and they probably, and with right, do not care what people who only theorise, criticise, and philosophise think! You write perfect code?! I doubt! And if you do, you will probably never finish any serious project in time!
Feb 03 2013
next sibling parent reply "bearophile" <bearophileHUGS lycos.com> writes:
Dejan Lekic:

 In real projects people do the job as best as they
 can at the moment,
But often there's also some need for: http://en.wikipedia.org/wiki/Code_review Bye, bearophile
Feb 03 2013
next sibling parent reply Paulo Pinto <pjmlp progtools.org> writes:
Am 03.02.2013 19:58, schrieb bearophile:
 Dejan Lekic:

 In real projects people do the job as best as they
 can at the moment,
But often there's also some need for: http://en.wikipedia.org/wiki/Code_review Bye, bearophile
If only most companies I worked for cared about it, or for that matter unit tests. :(
Feb 03 2013
parent reply Dejan Lekic <dejan.lekic gmail.com> writes:
Paulo Pinto wrote:

 Am 03.02.2013 19:58, schrieb bearophile:
 Dejan Lekic:

 In real projects people do the job as best as they
 can at the moment,
But often there's also some need for: http://en.wikipedia.org/wiki/Code_review Bye, bearophile
If only most companies I worked for cared about it, or for that matter unit tests. :(
I understand the girl is a researcher. They, especially if they are PhD students, have very strict deadlines, and have milestones to do. Finally, they in most cases work ALONE. With all due respect, but I find it disrespectful to criticise immediately the implementation, especially if it is something pretty serious. Finally, such critic, pull request, suggestion, whatever, should be directed *to the author herself*, or on project's mailing list, bugtrack, etc instead of posting here. Don't you agree? -- Dejan Lekic dejan.lekic (a) gmail.com http://dejan.lekic.org
Feb 04 2013
parent reply Paulo Pinto <pjmlp progtools.org> writes:
Am 04.02.2013 20:16, schrieb Dejan Lekic:
 Paulo Pinto wrote:

 Am 03.02.2013 19:58, schrieb bearophile:
 Dejan Lekic:

 In real projects people do the job as best as they
 can at the moment,
But often there's also some need for: http://en.wikipedia.org/wiki/Code_review Bye, bearophile
If only most companies I worked for cared about it, or for that matter unit tests. :(
I understand the girl is a researcher. They, especially if they are PhD students, have very strict deadlines, and have milestones to do. Finally, they in most cases work ALONE. With all due respect, but I find it disrespectful to criticise immediately the implementation, especially if it is something pretty serious. Finally, such critic, pull request, suggestion, whatever, should be directed *to the author herself*, or on project's mailing list, bugtrack, etc instead of posting here. Don't you agree?
100%
Feb 04 2013
parent reply "MattCoder" <mattcoder hotmail.com> writes:
On Monday, 4 February 2013 at 20:08:32 UTC, Paulo Pinto wrote:
 Am 04.02.2013 20:16, schrieb Dejan Lekic:
 Paulo Pinto wrote:

 Am 03.02.2013 19:58, schrieb bearophile:
 Dejan Lekic:

 In real projects people do the job as best as they
 can at the moment,
But often there's also some need for: http://en.wikipedia.org/wiki/Code_review Bye, bearophile
If only most companies I worked for cared about it, or for that matter unit tests. :(
I understand the girl is a researcher. They, especially if they are PhD students, have very strict deadlines, and have milestones to do. Finally, they in most cases work ALONE. With all due respect, but I find it disrespectful to criticise immediately the implementation, especially if it is something pretty serious. Finally, such critic, pull request, suggestion, whatever, should be directed *to the author herself*, or on project's mailing list, bugtrack, etc instead of posting here. Don't you agree?
100%
I agree too. But one thing that I saw is we should getting happy to see another project using D, but the focus went to her code instead! Let's take easy, and be glad that she is promoting D. And by the way, the project looks awesome!
Feb 04 2013
parent reply "Dejan Lekic" <dejan.lekic gmail.com> writes:
On Monday, 4 February 2013 at 23:02:04 UTC, MattCoder wrote:
 On Monday, 4 February 2013 at 20:08:32 UTC, Paulo Pinto wrote:
 Am 04.02.2013 20:16, schrieb Dejan Lekic:
 Paulo Pinto wrote:

 Am 03.02.2013 19:58, schrieb bearophile:
 Dejan Lekic:

 In real projects people do the job as best as they
 can at the moment,
But often there's also some need for: http://en.wikipedia.org/wiki/Code_review Bye, bearophile
If only most companies I worked for cared about it, or for that matter unit tests. :(
I understand the girl is a researcher. They, especially if they are PhD students, have very strict deadlines, and have milestones to do. Finally, they in most cases work ALONE. With all due respect, but I find it disrespectful to criticise immediately the implementation, especially if it is something pretty serious. Finally, such critic, pull request, suggestion, whatever, should be directed *to the author herself*, or on project's mailing list, bugtrack, etc instead of posting here. Don't you agree?
100%
I agree too. But one thing that I saw is we should getting happy to see another project using D, but the focus went to her code instead! Let's take easy, and be glad that she is promoting D. And by the way, the project looks awesome!
I absolutely agree.
Feb 05 2013
parent reply Matthew Caron <matt.caron redlion.net> writes:
On 02/05/2013 05:17 AM, Dejan Lekic wrote:
 On Monday, 4 February 2013 at 23:02:04 UTC, MattCoder wrote:
 And by the way, the project looks awesome!
I absolutely agree.
I don't, but that's because I hate JavaScript only slightly less than PHP or Python and want to see all of them die. -- Matthew Caron, Software Build Engineer Sixnet, a Red Lion business | www.sixnet.com +1 (518) 877-5173 x138 office
Feb 05 2013
parent reply FG <home fgda.pl> writes:
On 2013-02-05 18:24, Matthew Caron wrote:
 On 02/05/2013 05:17 AM, Dejan Lekic wrote:
 On Monday, 4 February 2013 at 23:02:04 UTC, MattCoder wrote:
 And by the way, the project looks awesome!
I absolutely agree.
I don't, but that's because I hate JavaScript only slightly less than PHP or Python and want to see all of them die.
I have similar feelings regarding PHP and Javascript. Not sure why you'd hate Python (except the obvious: indents, GIL). Nevertheless I hope one day I'll be able to replace Python with D in most cases.
Feb 05 2013
parent reply Matthew Caron <matt.caron redlion.net> writes:
On 02/05/2013 12:54 PM, FG wrote:
 On 2013-02-05 18:24, Matthew Caron wrote:
 I don't, but that's because I hate JavaScript only slightly less than
 PHP or
 Python and want to see all of them die.
I have similar feelings regarding PHP and Javascript. Not sure why you'd hate Python (except the obvious: indents, GIL). Nevertheless I hope one day I'll be able to replace Python with D in most cases.
I have a rule - any language which does not have a method by which one can force variable predeclaration is a toy and not suitable for real work. Perl's "use strict" is an example of this. I've spent too long chasing data going off into the ether because I typoed a variable name in an assignment. -- Matthew Caron, Software Build Engineer Sixnet, a Red Lion business | www.sixnet.com +1 (518) 877-5173 x138 office
Feb 05 2013
parent reply Walter Bright <newshound2 digitalmars.com> writes:
On 2/5/2013 10:57 AM, Matthew Caron wrote:
 I have a rule - any language which does not have a method by which one can
force
 variable predeclaration is a toy and not suitable for real work.
Yeah, autodeclaration is one of those things that gets regularly "invented" by newbies who think the rest of us are idiots for not having thought of it!
Feb 05 2013
parent reply "bearophile" <bearophileHUGS lycos.com> writes:
Walter Bright:

 Yeah, autodeclaration is one of those things that gets 
 regularly "invented" by newbies who think the rest of us are 
 idiots for not having thought of it!
Still, I prefer to use Python in many situations, like when I design a new algorithm, because it decreases the amount of brain I have to put on the language, freeing more brain to think about the actual problem. Python is a very well designed language. Bye, bearophile
Feb 05 2013
parent Matthew Caron <matt.caron redlion.net> writes:
On 02/05/2013 09:01 PM, bearophile wrote:
 Walter Bright:

 Yeah, autodeclaration is one of those things that gets regularly
 "invented" by newbies who think the rest of us are idiots for not
 having thought of it!
Still, I prefer to use Python in many situations, like when I design a new algorithm, because it decreases the amount of brain I have to put on the language, freeing more brain to think about the actual problem. Python is a very well designed language.
See, I use D for that these days - then I port it to C if there's no D cross compiler for the platform I'm using. -- Matthew Caron, Software Build Engineer Sixnet, a Red Lion business | www.sixnet.com +1 (518) 877-5173 x138 office
Feb 06 2013
prev sibling parent Matthew Caron <matt.caron redlion.net> writes:
On 02/03/2013 01:58 PM, bearophile wrote:
 Dejan Lekic:

 In real projects people do the job as best as they
 can at the moment,
But often there's also some need for: http://en.wikipedia.org/wiki/Code_review
Which is very difficult when attempting to bootstrap a new language into a company, to say nothing of working on some random project. I have that issue at work now - code is reviewed by C programmers, so they won't be able to compare one D idiom to another because they're not aware of either of them. -- Matthew Caron, Software Build Engineer Sixnet, a Red Lion business | www.sixnet.com +1 (518) 877-5173 x138 office
Feb 05 2013
prev sibling parent reply "Peter Alexander" <peter.alexander.au gmail.com> writes:
On Sunday, 3 February 2013 at 18:24:05 UTC, Dejan Lekic wrote:
 Welcome to reality Bearophile!!!

 In real projects people do the job as best as they can at the 
 moment, and they probably, and with right, do not care what 
 people who only theorise, criticise, and philosophise think! 
 You write perfect code?! I doubt! And if you do, you will 
 probably never finish any serious project in time!
That's besides the point. If people aren't using a feature of the language (e.g. contracts or const) then perhaps it is a sign of problems with those features, whether it be technical, or lack of tutorial, or poor documentation etc. I don't know if it is, but I find it interesting to observe how people use the language in real code.
Feb 03 2013
next sibling parent Paulo Pinto <pjmlp progtools.org> writes:
Am 03.02.2013 22:05, schrieb Peter Alexander:
 On Sunday, 3 February 2013 at 18:24:05 UTC, Dejan Lekic wrote:
 Welcome to reality Bearophile!!!

 In real projects people do the job as best as they can at the moment,
 and they probably, and with right, do not care what people who only
 theorise, criticise, and philosophise think! You write perfect code?!
 I doubt! And if you do, you will probably never finish any serious
 project in time!
That's besides the point. If people aren't using a feature of the language (e.g. contracts or const) then perhaps it is a sign of problems with those features, whether it be technical, or lack of tutorial, or poor documentation etc. I don't know if it is, but I find it interesting to observe how people use the language in real code.
Specially in offshore projects....
Feb 03 2013
prev sibling parent reply "Rob T" <alanb ucora.com> writes:
On Sunday, 3 February 2013 at 21:05:57 UTC, Peter Alexander wrote:
 On Sunday, 3 February 2013 at 18:24:05 UTC, Dejan Lekic wrote:
 Welcome to reality Bearophile!!!

 In real projects people do the job as best as they can at the 
 moment, and they probably, and with right, do not care what 
 people who only theorise, criticise, and philosophise think! 
 You write perfect code?! I doubt! And if you do, you will 
 probably never finish any serious project in time!
That's besides the point. If people aren't using a feature of the language (e.g. contracts or const) then perhaps it is a sign of problems with those features, whether it be technical, or lack of tutorial, or poor documentation etc. I don't know if it is, but I find it interesting to observe how people use the language in real code.
Good points. In the case at hand, the researcher is likely not expecting to re-use the code or maintain it past the projects termination point, so it's most likely a quick and dirty job. In fact she mentions that no attempts were made to optimize for performance because it's a proof of concept, which suggests throw away code. BTW, I've been digging away on D for a few months now, and have written a fair amount of D code, yet I still have not explored all of the languages features and even after I've looked at everything it's very likely I will not use all of the available features because it's very likely not all of it will add enough value, and may even complicate matters in practice more than it promises to simplify in theory. --rt
Feb 04 2013
parent "Rob T" <alanb ucora.com> writes:
It would be nice to know why she choose D.

Possibly the reason is because she wanted to write code quickly, 
which is one of the advantages that D is supposed to provide over 
some other languages.

--rt
Feb 04 2013
prev sibling next sibling parent reply Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> writes:
On Sun, 03 Feb 2013 14:56:12 +0100
"bearophile" <bearophileHUGS lycos.com> wrote:
 
 The author has used asserts at the beginning of methods, outside 
 a the pre-condition, this is silly.
Why is it silly? (Genuine question)
 Not using foreach loops on 
 numerical intervals is a waste of fingers and increases the risk 
 of mistakes, final switches often help you, text() is shorter 
 than to!string(),
Yea, I agree there. Although I've found that the existence of text() is easy to overlook (and if I were looking for it, I'd be looking in std.string, though I realize it makes sense either way). Also, AIUI, "foreach(i; 0..10)" involves a range and function calls, so perhaps they want to be certain there isn't any overhead that accidentally fails to get optimized out? Plus they may be new to D, now be aware of things like "final switch" or exactly which of the advanced features are potentially problematic.
Feb 03 2013
next sibling parent "Peter Alexander" <peter.alexander.au gmail.com> writes:
On Sunday, 3 February 2013 at 20:54:29 UTC, Nick Sabalausky wrote:
 Also, AIUI, "foreach(i; 0..10)" involves a range and function 
 calls, so
 perhaps they want to be certain there isn't any overhead that
 accidentally fails to get optimized out?
There is no range or function calls! That syntax existed well before ranges were even conceived. It is nothing more than shorthand for the obvious for-loop alternative.
Feb 03 2013
prev sibling parent reply "bearophile" <bearophileHUGS lycos.com> writes:
Nick Sabalausky:

 Why is it silly? (Genuine question)
"Silly" wasn't the right word, sorry. But generally if a language offers you a clean feature (D contract programming is designed clean enough) it's better to use it, when you clearly need it. In D you can live without D contract programming, but is useful, and it's better to know it. (I'd also like Phobos to replace most of its usages of enforce() with asserts inside contracts.) Bye, bearophile
Feb 03 2013
parent reply "Peter Alexander" <peter.alexander.au gmail.com> writes:
On Sunday, 3 February 2013 at 22:00:05 UTC, bearophile wrote:
 Nick Sabalausky:

 Why is it silly? (Genuine question)
"Silly" wasn't the right word, sorry. But generally if a language offers you a clean feature (D contract programming is designed clean enough) it's better to use it, when you clearly need it.
I don't use D contracts, even though I use asserts. I find that adding contracts bloats my code quite a lot, making it less readable. real log(real x) in { assert(x > 0); } body { return ...; } v.s. real log(real x) { assert(x > 0); return ...; } As far as I'm aware there is no difference except when inheritance is involved, so it's an easy choice for me.
Feb 03 2013
next sibling parent "bearophile" <bearophileHUGS lycos.com> writes:
Peter Alexander:

 I don't use D contracts, even though I use asserts.

 I find that adding contracts bloats my code quite a lot, making 
 it less readable.

 real log(real x)
 in
 {
     assert(x > 0);
 }
 body
 {
     return ...;
 }

 v.s.

 real log(real x)
 {
     assert(x > 0);
     return ...;
 }

 As far as I'm aware there is no difference except when 
 inheritance is involved, so it's an easy choice for me.
If you have to create some temporary values (or to perform some computation) for your asserts you probably want to put this code inside a {} to avoid such names to spill inside the body of the function. There are also post-conditions, that catch all the returns you have in your function, unlike free asserts. There are also loop invariants, missing in D contract programming: http://d.puremagic.com/issues/show_bug.cgi?id=9300 Also, a well designed language enforces pre and post conditions to not mutate values (this is an ongoing discussion in D: http://d.puremagic.com/issues/show_bug.cgi?id=9408 ), and offers you the "old" (prestate) feature only inside contracts (missing still in D contract programming). Contracts also make life a little simpler for static analysis tools (that aren't yet available in D). So the better contract programming is implemented in a language (and its tools), the more useful it is compared to using free asserts. Bye, bearophile
Feb 03 2013
prev sibling parent Timon Gehr <timon.gehr gmx.ch> writes:
On 02/03/2013 11:14 PM, Peter Alexander wrote:
 On Sunday, 3 February 2013 at 22:00:05 UTC, bearophile wrote:
 Nick Sabalausky:

 Why is it silly? (Genuine question)
"Silly" wasn't the right word, sorry. But generally if a language offers you a clean feature (D contract programming is designed clean enough) it's better to use it, when you clearly need it.
I don't use D contracts, even though I use asserts. I find that adding contracts bloats my code quite a lot, making it less readable. real log(real x) in { assert(x > 0); } body { return ...; }
If the code is written consistently in this vertically-bloated style, it is 'less readable' anyway. Contracts will not make a huge difference. :o)
 v.s.

 real log(real x)
 {
      assert(x > 0);
      return ...;
 }
real log(real x) in{ assert(x > 0); }body{ return ...; } real log(real x) in{ assert(x > 0); }body{ return ...; }
 As far as I'm aware there is no difference except when inheritance is
 involved, so it's an easy choice for me.
The difference is that the first version of log given above may be correct whereas the second is certainly buggy (pass in 0 and it fails). As correctness is not necessarily modular, the entire code base as a unit may still work correctly if it contains either version. That's why your approach is practicable in the absence of a tool/review process that checks assertions in a modular way.
Feb 03 2013
prev sibling next sibling parent reply "Michael" <pr m1xa.com> writes:
Best code, it's which works and the client is satisfied.
Feb 03 2013
parent reply Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> writes:
On Sun, 03 Feb 2013 22:15:09 +0100
"Michael" <pr m1xa.com> wrote:

 Best code, it's which works and the client is satisfied.
And the end users are satisfied. AND doesn't cause problems when it inevitably needs maintenance. And isn't prone to crapping out or breaches of security.
Feb 03 2013
next sibling parent "Michael" <pr m1xa.com> writes:
Yes, you are right. But it's all is just nuances )))
Feb 04 2013
prev sibling parent reply Dejan Lekic <dejan.lekic gmail.com> writes:
Nick Sabalausky wrote:

 On Sun, 03 Feb 2013 22:15:09 +0100
 "Michael" <pr m1xa.com> wrote:
 
 Best code, it's which works and the client is satisfied.
And the end users are satisfied. AND doesn't cause problems when it inevitably needs maintenance. And isn't prone to crapping out or breaches of security.
AND you expect that from ONE, single person who is implementing something like Higgs? :) Come on, be realistic... -- Dejan Lekic dejan.lekic (a) gmail.com http://dejan.lekic.org
Feb 04 2013
next sibling parent "Michael" <pr m1xa.com> writes:
On Monday, 4 February 2013 at 19:19:06 UTC, Dejan Lekic wrote:
 Nick Sabalausky wrote:

 On Sun, 03 Feb 2013 22:15:09 +0100
 "Michael" <pr m1xa.com> wrote:
 
 Best code, it's which works and the client is satisfied.
And the end users are satisfied. AND doesn't cause problems when it inevitably needs maintenance. And isn't prone to crapping out or breaches of security.
AND you expect that from ONE, single person who is implementing something like Higgs? :) Come on, be realistic...
Yes, you are right. But it's all is just nuances ))) P.S.: For completeness ;)
Feb 04 2013
prev sibling parent Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> writes:
On Mon, 04 Feb 2013 19:19 +0000
Dejan Lekic <dejan.lekic gmail.com> wrote:

 Nick Sabalausky wrote:
 
 On Sun, 03 Feb 2013 22:15:09 +0100
 "Michael" <pr m1xa.com> wrote:
 
 Best code, it's which works and the client is satisfied.
And the end users are satisfied. AND doesn't cause problems when it inevitably needs maintenance. And isn't prone to crapping out or breaches of security.
AND you expect that from ONE, single person who is implementing something like Higgs? :) Come on, be realistic...
Just to be clear, I was replying to the comment about what qualifies as "best" code. I never said anything about *expecting* anything.
Feb 09 2013
prev sibling next sibling parent reply Matthew Caron <matt.caron redlion.net> writes:
On 02/03/2013 08:56 AM, bearophile wrote:
 text() is shorter than to!string(),
In all fairness, I wasn't aware of text until this comment, so perhaps the author was not either? For the curious, I found docs here, since I now knew what I was looking for: http://dlang.org/phobos/std_conv.html#.text -- Matthew Caron, Software Build Engineer Sixnet, a Red Lion business | www.sixnet.com +1 (518) 877-5173 x138 office
Feb 05 2013
parent reply FG <home fgda.pl> writes:
On 2013-02-05 18:21, Matthew Caron wrote:
 In all fairness, I wasn't aware of text until this comment, so perhaps the
 author was not either?
There are still many examples around with to!string, so it's easy not to notice text() if you are like me and stop looking after you found something that works. :) In previous version of Phobos text(...) is used 168 and to!string 181 times, and in 2.061 DMD release the proportions are rather similar.
Feb 05 2013
parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 2/5/13 1:04 PM, FG wrote:
 On 2013-02-05 18:21, Matthew Caron wrote:
 In all fairness, I wasn't aware of text until this comment, so perhaps
 the
 author was not either?
There are still many examples around with to!string, so it's easy not to notice text() if you are like me and stop looking after you found something that works. :) In previous version of Phobos text(...) is used 168 and to!string 181 times, and in 2.061 DMD release the proportions are rather similar.
Care for a shotgun search/replace pull request? Andrei
Feb 05 2013
next sibling parent reply "Adam D. Ruppe" <destructionator gmail.com> writes:
I prefer to!string to text() because you can use the same to!T 
pattern for a great many types T.

text is something I use more only when I want to do multiple 
arguments together.
Feb 05 2013
next sibling parent reply Dmitry Olshansky <dmitry.olsh gmail.com> writes:
05-Feb-2013 22:59, Adam D. Ruppe пишет:
 I prefer to!string to text() because you can use the same to!T pattern
 for a great many types T.
wtext, dtext
 text is something I use more only when I want to do multiple arguments
 together.
Actually me too, to!string feels more explicit. -- Dmitry Olshansky
Feb 05 2013
parent reply "Adam D. Ruppe" <destructionator gmail.com> writes:
On Tuesday, 5 February 2013 at 19:02:19 UTC, Dmitry Olshansky 
wrote:
 wtext, dtext
to!int, etc too
Feb 05 2013
parent Walter Bright <newshound2 digitalmars.com> writes:
On 2/5/2013 11:10 AM, Adam D. Ruppe wrote:
 On Tuesday, 5 February 2013 at 19:02:19 UTC, Dmitry Olshansky wrote:
 wtext, dtext
to!int, etc too
toto too!
Feb 05 2013
prev sibling parent =?UTF-8?B?QWxpIMOHZWhyZWxp?= <acehreli yahoo.com> writes:
On 02/05/2013 10:59 AM, Adam D. Ruppe wrote:
 I prefer to!string to text() because you can use the same to!T pattern
 for a great many types T.
+1 Ali
Feb 05 2013
prev sibling parent reply Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
On 2/5/13, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:
 Care for a shotgun search/replace pull request?
Looking at the implementation: string text(T...)(T args) { return textImpl!string(args); } private S textImpl(S, U...)(U args) { S result; foreach (i, arg; args) { result ~= to!S(args[i]); } return result; } I can see 2 optimizations here: 1. Use a static if to replace the append operator with a simple return when there's only one argument 2. Use Appender instead of a regular string for multiple arguments. Unfortunately #2 won't fly because std.regex uses text and it expects it to be safe, but Appender isn't safe.
Feb 05 2013
parent Dmitry Olshansky <dmitry.olsh gmail.com> writes:
05-Feb-2013 23:01, Andrej Mitrovic пишет:
 On 2/5/13, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:
 Care for a shotgun search/replace pull request?
Looking at the implementation: string text(T...)(T args) { return textImpl!string(args); } private S textImpl(S, U...)(U args) { S result; foreach (i, arg; args) { result ~= to!S(args[i]); } return result; } I can see 2 optimizations here: 1. Use a static if to replace the append operator with a simple return when there's only one argument 2. Use Appender instead of a regular string for multiple arguments. Unfortunately #2 won't fly because std.regex uses text and it expects it to be safe, but Appender isn't safe.
Time to make Appender trusted and linch the author if it's not that safe inside? ;) But seriously it would silently allow system OutputRanges... trusted needs re-design. -- Dmitry Olshansky
Feb 05 2013
prev sibling parent "deadalnix" <deadalnix gmail.com> writes:
On Sunday, 3 February 2013 at 13:56:13 UTC, bearophile wrote:
 deadalnix:

 The code seems to miss the usage of contracts, foreach loops 
 on numerical intervals, final switch, toString with sink, 
 text() function, enum for compile-time constants, most const 
 arguments, const on methods.
My experience tells me that this is probably a good idea if you don't want to run into weirdland.
Among those things I have listed, probably the only ones that give a little of troubles are const on methods. The author has used asserts at the beginning of methods, outside a the pre-condition, this is silly.
I faced memory corruption in out contract and invariants in the past. So I can't really blame people that don't want to run into such trouble.
Feb 05 2013
prev sibling next sibling parent "bearophile" <bearophileHUGS lycos.com> writes:
Paulo Pinto:

 More information on her blog,

 http://pointersgonewild.wordpress.com/2013/01/31/visiting-mozilla/
I like the slides because they don't contain a page titled "Why D?" nor they talk about D: http://pointersgonewild.files.wordpress.com/2013/01/higgs-presentation.pdf Bye, bearophile
Feb 03 2013
prev sibling parent "Michael" <pr m1xa.com> writes:
As she noted in its journal, maybe she give a keynote talk at 
DConf 2013.
Additionaly, I think it would be great to take an interview with 
her.
Feb 06 2013