Re: Interview at Lang.NEXT

2014-06-17 Thread Jacob Carlborg via Digitalmars-d-announce

On 16/06/14 16:00, Bruno Medeiros wrote:


I sometimes tried to convince dynamic language proponents - the ones
that write unittests at least - of the benefits of static typing, by
stating that static typing is really just compile time unit-tests! (it
is actually)


You can actually do compile time unit tests in D, that is not the type 
system. I.e. unit tests for CTFE functions that runs at compile time. 
Pretty cool actually :)


--
/Jacob Carlborg


Re: D port of docopt

2014-06-17 Thread Jacob Carlborg via Digitalmars-d-announce

On 16/06/14 15:31, Bob Tolbert wrote:


While that is true, I'd argue that if you are writing an app with
a command line that complicated, then you have your work cut out
for you no matter what the system is you use.


It would be nice to see a simpler example of how to use the library 
after parsing. Most examples now just do writeln(arguments);.


--
/Jacob Carlborg


Re: Lang.NEXT panel (dfix)

2014-06-17 Thread Jacob Carlborg via Digitalmars-d-announce

On 16/06/14 15:43, Bruno Medeiros wrote:


What's keeping us from having such a tool? It seems that after one has a
decent parser (that also keeps tracks of the source ranges of AST
nodes), it's easy to write code that does syntactic modifications and
then rewrites the source code. And there's several D parsers out there
already - so it should be too much effort to get there.
Even I am working on a tool that can be easily retrofitted for this
purpose.

Or maybe I am misunderstanding the amount of semantic analysis that
would typically be required? Can someone give some examples of
modifications that would be useful for such a dfix tool? (I haven't yet
had the time to watch the full panel video, if that's relevant)


* The parser haven't been available for that long (I think)
* Can they handle whole language?
* Semantic analysis is needed. Otherwise as soon as someone uses 
templates or mixins the tool won't properly work


--
/Jacob Carlborg


Re: D port of docopt

2014-06-17 Thread Jacob Carlborg via Digitalmars-d-announce

On 16/06/14 23:11, Dicebot wrote:


I don't think it gives any advantage here :)

docopt looks cool, though my I'd prefer something that works other way
around - automatically generates argument parsing code and help messages
from aggregate that represents configuration and/or CLI API (with help
of few UDA).


Same here. I use the argument parser in Tango [1], which I think works 
well. I have extended the one in Tango to support generating the help 
message, and some other stuff as well [2].


[1] http://siegelord.github.io/Tango-D2/tango.text.Arguments.html
[2] https://github.com/jacob-carlborg/mambo/tree/master/mambo/arguments

--
/Jacob Carlborg


Re: Lang.NEXT panel (dfix)

2014-06-17 Thread Bruno Medeiros via Digitalmars-d-announce

On 16/06/2014 22:10, Stefan Koch wrote:

The thing I have in mind should be really easy for simple tasks
as in
`if constuctor in any class has parameter of type oldRouter change
that parameter to type new Router`
but i habe yet to find a good notation for that


I guess a DSL for simple manipulations can be ok to have. But for more 
complex stuff better to just use the language the parser is written in.

I'd guess most people would just be using pre-written manipulations anyways.

--
Bruno Medeiros
https://twitter.com/brunodomedeiros


Re: DConf Day 1 Talk 6: Case Studies in Simplifying Code with Compile-Time Reflection by Atila Neves

2014-06-17 Thread Joakim via Digitalmars-d-announce

On Monday, 16 June 2014 at 17:26:51 UTC, Andrei Alexandrescu
wrote:

https://news.ycombinator.com/newest

https://www.facebook.com/dlang.org/posts/867399893273693

https://twitter.com/D_Programming/status/478588866321203200

http://www.reddit.com/r/programming/comments/28am0x/case_studies_in_simplifying_code_with_compiletime/


Great talk, missed this on the livestream as I went to sleep.
Between Dmitry's regex talk and this one, good to see talks
demonstrating how they actually used D to build something
interesting and how D-specific features helped them build it
better.  These talks are much better than the more abstract
talks, hopefully we see more of them next year.


Re: Lang.NEXT panel (dfix)

2014-06-17 Thread Bruno Medeiros via Digitalmars-d-announce

On 17/06/2014 07:25, Jacob Carlborg wrote:

On 16/06/14 15:43, Bruno Medeiros wrote:


What's keeping us from having such a tool? It seems that after one has a
decent parser (that also keeps tracks of the source ranges of AST
nodes), it's easy to write code that does syntactic modifications and
then rewrites the source code. And there's several D parsers out there
already - so it should be too much effort to get there.
Even I am working on a tool that can be easily retrofitted for this
purpose.

Or maybe I am misunderstanding the amount of semantic analysis that
would typically be required? Can someone give some examples of
modifications that would be useful for such a dfix tool? (I haven't yet
had the time to watch the full panel video, if that's relevant)


* The parser haven't been available for that long (I think)
* Can they handle whole language?


Dunno about DScanner, but if it's being used in DCD, I'd guess it can 
handle the whole language, or be fairly close to it.


Similarly, there is also DParser2 from MonoD and the DDT parser (for the 
tool I'm working on)



* Semantic analysis is needed. Otherwise as soon as someone uses
templates or mixins the tool won't properly work



I think there would be a lot of modifications that one can do without 
semantic analysis (or limited analysis). But that's why I asked for 
examples of dfix scenarios.


Adding final to every method in certain classes could be done without 
semantic analysis. Reworking certain constructs to different constructs 
possibly as well (for example change foreach_reverse to just foreach usage)


--
Bruno Medeiros
https://twitter.com/brunodomedeiros


Re: Lang.NEXT panel (dfix)

2014-06-17 Thread Bruno Medeiros via Digitalmars-d-announce

On 17/06/2014 16:45, Bruno Medeiros wrote:

Dunno about DScanner, but if it's being used in DCD, I'd guess it can
handle the whole language, or be fairly close to it.

Similarly, there is also DParser2 from MonoD and the DDT parser (for the
tool I'm working on)



And DDT is fairly complete, AFAIK, and well covered in tests. There 
might be some syntax I have missed if I misunderstood the grammar, but 
that should be fixable easily.


--
Bruno Medeiros
https://twitter.com/brunodomedeiros


Re: Lang.NEXT panel (dfix)

2014-06-17 Thread Bruno Medeiros via Digitalmars-d-announce

On 17/06/2014 16:45, Bruno Medeiros wrote:

Similarly, there is also DParser2 from MonoD and the DDT parser (for the
tool I'm working on)


And the DDT parser is fairly complete, AFAIK, and well covered in tests. 
There might be some syntax I have missed if I misunderstood the grammar 
spec, but that should be fixable easily.


--
Bruno Medeiros
https://twitter.com/brunodomedeiros


Re: DConf Day 1 Talk 6: Case Studies in Simplifying Code with Compile-Time Reflection by Atila Neves

2014-06-17 Thread Mengu via Digitalmars-d-announce

On Monday, 16 June 2014 at 22:14:01 UTC, Adam D. Ruppe wrote:
The reddit response this year hasn't been particularly 
impressive it seems to me compared to last year :(


r/programming and hn is all about rust and go. on hn many d posts 
are invisible after some time. i believe mods are taking action 
there. if we want their attention, we should compare d with 
others; we should benchmark d and brag about the results etc. 
other than that, people are not paying attention to D and it's 
beautiful features.


and also the genius idea to post each talk seperately instead of 
having a nice talks page on dconf.org and providing a link for 
that. i'd understand the keynotes but for the rest of the talks 
this is / was not a good idea.


Re: Lang.NEXT panel (dfix)

2014-06-17 Thread deadalnix via Digitalmars-d-announce

On Tuesday, 17 June 2014 at 15:45:55 UTC, Bruno Medeiros wrote:

Dunno about DScanner, but if it's being used in DCD, I'd guess 
it can handle the whole language, or be fairly close to it.


Similarly, there is also DParser2 from MonoD and the DDT parser 
(for the tool I'm working on)




HAHAHAHAHAHA ! (The author of these actual tools will tell you 
the same).


* Semantic analysis is needed. Otherwise as soon as someone 
uses

templates or mixins the tool won't properly work



I think there would be a lot of modifications that one can do 
without semantic analysis (or limited analysis). But that's why 
I asked for examples of dfix scenarios.




Until you hit a static if. Which is always.

Adding final to every method in certain classes could be done 
without semantic analysis. Reworking certain constructs to 
different constructs possibly as well (for example change 
foreach_reverse to just foreach usage)


ditto.


Re: D port of docopt

2014-06-17 Thread Bob Tolbert via Digitalmars-d-announce

On Tuesday, 17 June 2014 at 06:29:14 UTC, Jacob Carlborg wrote:

On 16/06/14 15:31, Bob Tolbert wrote:

While that is true, I'd argue that if you are writing an app 
with
a command line that complicated, then you have your work cut 
out

for you no matter what the system is you use.


It would be nice to see a simpler example of how to use the 
library after parsing. Most examples now just do 
writeln(arguments);.


So I agree it would be nice to have a more real example. I am 
open to suggestions or working with someone that needs a CLI 
update.


I thought about a small version of grep or ack written in D, but 
not sure if that is a waste of time when there might be a more 
interesting need for something new or different.


Bob


Re: Lang.NEXT panel (dfix)

2014-06-17 Thread Jacob Carlborg via Digitalmars-d-announce

On Tuesday, 17 June 2014 at 15:45:55 UTC, Bruno Medeiros wrote:

Adding final to every method in certain classes could be done 
without semantic analysis. Reworking certain constructs to 
different constructs possibly as well (for example change 
foreach_reverse to just foreach usage)


What about methods added via template and string mixins? You 
cannot add final to a method in a template, because you don't 
know if it will be mixed in into a class or struct (does the 
compiler allow final on struct methods?). There's no possible 
way to handle string mixins, a method can be built up by 
concatenating strings.


--
/Jacob Carlborg


Re: Lang.NEXT panel (dfix)

2014-06-17 Thread Bruno Medeiros via Digitalmars-d-announce

On 17/06/2014 19:10, deadalnix wrote:

On Tuesday, 17 June 2014 at 15:45:55 UTC, Bruno Medeiros wrote:


Dunno about DScanner, but if it's being used in DCD, I'd guess it can
handle the whole language, or be fairly close to it.

Similarly, there is also DParser2 from MonoD and the DDT parser (for
the tool I'm working on)



HAHAHAHAHAHA ! (The author of these actual tools will tell you the same).



I don't understand what point is it you're trying to say here...
Are you saying it's ludicrous that people have written complete parsers 
for D?



* Semantic analysis is needed. Otherwise as soon as someone uses
templates or mixins the tool won't properly work



I think there would be a lot of modifications that one can do without
semantic analysis (or limited analysis). But that's why I asked for
examples of dfix scenarios.



Until you hit a static if. Which is always.


Adding final to every method in certain classes could be done
without semantic analysis. Reworking certain constructs to different
constructs possibly as well (for example change foreach_reverse to
just foreach usage)


ditto.


How would a static if prevent a tool from adding final to every method 
in a specified class?



--
Bruno Medeiros
https://twitter.com/brunodomedeiros


Re: Lang.NEXT panel (dfix)

2014-06-17 Thread Bruno Medeiros via Digitalmars-d-announce

On 17/06/2014 20:12, Jacob Carlborg wrote:

On Tuesday, 17 June 2014 at 15:45:55 UTC, Bruno Medeiros wrote:


Adding final to every method in certain classes could be done
without semantic analysis. Reworking certain constructs to different
constructs possibly as well (for example change foreach_reverse to
just foreach usage)


What about methods added via template and string mixins? You cannot add
final to a method in a template, because you don't know if it will be
mixed in into a class or struct (does the compiler allow final on
struct methods?). There's no possible way to handle string mixins, a
method can be built up by concatenating strings.

--
/Jacob Carlborg


Methods added through string mixins would not work. Actually, any AST 
modification would probably not work through string mixins. That would 
be an incredibly difficult problem to solve - in many cases, impossible 
even.
And perhaps rightly so, one could make a case that string mixins should 
be used sparsely? We have to realize that string mixins are very useful, 
but are a dirty hack that is a replacement for AST macros.


As for methods added via templates, the tool would present the option to 
add final to those templates as well, or just the class. If doing do 
might break other classes that use the same template, well, that is a 
problem that transcends whether this transformation is done manually or 
by a tool. It would not be an issue with dfix itself then.


--
Bruno Medeiros
https://twitter.com/brunodomedeiros


Re: Lang.NEXT panel (dfix)

2014-06-17 Thread Dicebot via Digitalmars-d-announce

On Tuesday, 17 June 2014 at 19:48:42 UTC, Bruno Medeiros wrote:

On 17/06/2014 19:10, deadalnix wrote:

On Tuesday, 17 June 2014 at 15:45:55 UTC, Bruno Medeiros wrote:

Dunno about DScanner, but if it's being used in DCD, I'd 
guess it can

handle the whole language, or be fairly close to it.

Similarly, there is also DParser2 from MonoD and the DDT 
parser (for

the tool I'm working on)



HAHAHAHAHAHA ! (The author of these actual tools will tell you 
the same).




I don't understand what point is it you're trying to say here...
Are you saying it's ludicrous that people have written complete 
parsers for D?


Parsing D is relatively simple but making any reliable changes 
without full (and mean _full_) semantic analysis is close to 
impossible because of code generation and interleaving semantic 
stages.


Re: DConf Day 1 Talk 6: Case Studies in Simplifying Code with Compile-Time Reflection by Atila Neves

2014-06-17 Thread Tofu Ninja via Digitalmars-d-announce
On Monday, 16 June 2014 at 17:26:51 UTC, Andrei Alexandrescu 
wrote:

https://news.ycombinator.com/newest

https://www.facebook.com/dlang.org/posts/867399893273693

https://twitter.com/D_Programming/status/478588866321203200

http://www.reddit.com/r/programming/comments/28am0x/case_studies_in_simplifying_code_with_compiletime/


Andrei


This is the most interesting talk I have seen so far from 
DConf14, very good.


-tofu


Re: DConf Day 1 Talk 6: Case Studies in Simplifying Code with Compile-Time Reflection by Atila Neves

2014-06-17 Thread Tofu Ninja via Digitalmars-d-announce

On Tuesday, 17 June 2014 at 17:10:16 UTC, Mengu wrote:
and also the genius idea to post each talk seperately instead 
of having a nice talks page on dconf.org and providing a link 
for that. i'd understand the keynotes but for the rest of the 
talks this is / was not a good idea.


I think the hope was that it would attract more views overall. I 
think what was not taken into account was the way Reddit post get 
viewed, having their up votes spread out among the different 
posts is much worse than pooling them as the reddit posts are far 
less likely to be viewed with low up vote counts. Also its 
annoying for us who just want to watch the talks.


A much better strategy would have been a full release of all the 
talks followed with a reddit post of all of them to get the large 
burst up front, then after wards have individual posts for each 
video to get the staggering as well. It would effectively doubled 
each videos exposure(reddit is all reposts any ways so its all 
the better :P).


Re: DConf Day 1 Talk 6: Case Studies in Simplifying Code with Compile-Time Reflection by Atila Neves

2014-06-17 Thread Joakim via Digitalmars-d-announce

On Tuesday, 17 June 2014 at 17:10:16 UTC, Mengu wrote:

On Monday, 16 June 2014 at 22:14:01 UTC, Adam D. Ruppe wrote:
The reddit response this year hasn't been particularly 
impressive it seems to me compared to last year :(


r/programming and hn is all about rust and go. on hn many d 
posts are invisible after some time. i believe mods are taking 
action there. if we want their attention, we should compare d 
with others; we should benchmark d and brag about the results 
etc. other than that, people are not paying attention to D and 
it's beautiful features.


I don't know why people bother with those silly sites, which I 
don't read at all unless they're linked here.  None of these 
benchmarks or other links matter.  Nobody paid attention to ruby 
for a decade, until David Hansson built rails with it.


I have seen over and over again that nobody has the ability to 
reason about an idea or tool like this.  You have to build 
something better with it, something they want, then they'll all 
flock to use or copy it.


You want to show how great D is, build something great with it.  
Nothing else matters.


and also the genius idea to post each talk seperately instead 
of having a nice talks page on dconf.org and providing a link 
for that. i'd understand the keynotes but for the rest of the 
talks this is / was not a good idea.


Don't you know that it's better to maintain a steady stream of 
publicity for D on sites full of people who always dismiss it, 
rather than making the talks available immediately to the people 
who actually use D and want to watch them?


endSarcasm();

I don't mind it as much, because I'm not bingeing on the talks 
and spreading out watching them instead, but it'd be nice to see 
the talks I missed on the livestream and want to watch now, 
rather than at some indeterminate date in the future.


Re: DConf Day 1 Talk 6: Case Studies in Simplifying Code with Compile-Time Reflection by Atila Neves

2014-06-17 Thread safety0ff via Digitalmars-d-announce

On Tuesday, 17 June 2014 at 22:09:06 UTC, Joakim wrote:
I don't mind it as much, because I'm not bingeing on the talks 
and spreading out watching them instead, but it'd be nice to 
see the talks I missed on the livestream and want to watch now, 
rather than at some indeterminate date in the future.


I just wish they would release the day 3 afternoon talks sooner 
since I (as well as others) missed them.


Re: DConf Day 1 Talk 6: Case Studies in Simplifying Code with Compile-Time Reflection by Atila Neves

2014-06-17 Thread Meta via Digitalmars-d-announce

On Tuesday, 17 June 2014 at 22:09:06 UTC, Joakim wrote:
Don't you know that it's better to maintain a steady stream of 
publicity for D on sites full of people who always dismiss it, 
rather than making the talks available immediately to the 
people who actually use D and want to watch them?


Every day until you like it.


core.checkedint added to druntime

2014-06-17 Thread Walter Bright via Digitalmars-d-announce

https://github.com/D-Programming-Language/druntime/pull/839

While being a very modest piece of code in and of itself, I believe this offers 
a significant opportunity that both D compilers and user defined types can exploit.


Not only can it be used to create an efficient safeint data type, it can be used 
to implement multi-precision integer arithmetic types.


I'd also like to see it used to replace the various ad-hoc schemes currently in 
use. It should also be used in dmd itself for things like detecting array size 
overflows, which is currently done ad-hoc, and detecting overflows in CTFE.


For background information and rationale, see 
http://blog.regehr.org/archives/1139