Re: The D Scripting Language

2010-11-26 Thread Bruno Medeiros
On 07/11/2010 21:29, Tomek Sowiński wrote: This wraps up a thread from a few days ago. Pascal featured my D examples on his Scriptometer site. http://rigaux.org/language-study/scripting-language/ D comes 17th out of 28, so it's so-so for scripting. Hum, nice, I think this is a very

Re: The D Scripting Language

2010-11-26 Thread Bruno Medeiros
On 11/11/2010 13:50, Alexander Malakhov wrote: Perhaps a module std.scripting could help quite a lot, too. module std.script; public import std.stdio, std.file, std.process, std.algorithm, ... etc I use at least some of these for most of my programs/scripts. And std.all is probably a

Re: The D Scripting Language

2010-11-19 Thread gooba
spir Wrote: On Tue, 16 Nov 2010 09:44:06 +0100 Per Ångström d-n...@autark.se wrote: On 2010-11-16 01:10, Daniel Murphy wrote: I think allowing the second expression in the ternary operator to be omitted would be a better fit for D, and provide the same function. ie.

Re: The D Scripting Language

2010-11-19 Thread Leandro Lucarella
By the way, I found a bug that I think is quite serious if DMD wants to hit the scripting languages world: http://d.puremagic.com/issues/show_bug.cgi?id=5243 Copied for convenience: dmd -run potentially removes user files See this example: $ mkdir x $ echo 'void main() {}' x/test.d $ echo my

Re: The D Scripting Language

2010-11-16 Thread Per Ångström
On 2010-11-16 01:10, Daniel Murphy wrote: I think allowing the second expression in the ternary operator to be omitted would be a better fit for D, and provide the same function. ie. auto x = a ? a : b; auto x = a ? : b; Personally I had '|||' in mind, but I'm OK with '?:'. I think it should

Re: The D Scripting Language

2010-11-16 Thread spir
On Tue, 16 Nov 2010 09:44:06 +0100 Per Ångström d-n...@autark.se wrote: On 2010-11-16 01:10, Daniel Murphy wrote: I think allowing the second expression in the ternary operator to be omitted would be a better fit for D, and provide the same function. ie. auto x = a ? a : b; auto x =

Re: The D Scripting Language

2010-11-16 Thread Leandro Lucarella
Daniel Murphy, el 16 de noviembre a las 10:10 me escribiste: Per �ngstr�m d-n...@autark.se wrote in message news:ibr8bs$22m...@digitalmars.com... return s || default; I think allowing the second expression in the ternary operator to be omitted would be a better fit for D, and provide

Re: The D Scripting Language

2010-11-16 Thread Alexey Khmara
Script mode (actually - simple wrapper) would be better: It could do simple parsing of script, bringing all import clauses to the beginning and add some default imports (like std.stdio). It seems that all code below imports can be wrapped into main declaration. So for writeln(hello, world!); we

Re: The D Scripting Language

2010-11-16 Thread Adam Ruppe
Script mode (actually - simple wrapper) would be better: It could do simple parsing of script, bringing all import clauses to the beginning and add some default imports (like std.stdio). It seems that all code below imports can be wrapped into main declaration. My rund.d program does this.

Re: The D Scripting Language

2010-11-16 Thread Alexey Khmara
I really think that it would be good to ship something like this with dmd and promote it default D script handler. May be, parsing must be more complicated (I'm not sure that all features will work inside main()), but as D is easy for parsing I see no big problems.Of cource, we can add more

Re: The D Scripting Language

2010-11-15 Thread Per Ångström
On 2010-11-07 22:29, Tomek Sowiński wrote: This wraps up a thread from a few days ago. Pascal featured my D examples on his Scriptometer site. http://rigaux.org/language-study/scripting-language/ D comes 17th out of 28, so it's so-so for scripting. I'm wondering whether the issue of D's

Re: The D Scripting Language

2010-11-15 Thread spir
On Mon, 15 Nov 2010 13:15:50 +0100 Per Ångström d-n...@autark.se wrote: On 2010-11-07 22:29, Tomek Sowiński wrote: This wraps up a thread from a few days ago. Pascal featured my D examples on his Scriptometer site. http://rigaux.org/language-study/scripting-language/ D comes 17th out

Re: The D Scripting Language

2010-11-15 Thread bearophile
spir: I *want* my language of choice to let me write clear code -- During the design stages of Python3 I've even asked to remove those dirty boolean shortcuts of Python2 :-) Bye, bearophile

Re: The D Scripting Language

2010-11-15 Thread Per Ångström
On 2010-11-15 14:27, spir wrote: On Mon, 15 Nov 2010 13:15:50 +0100 Per Ångströmd-n...@autark.se wrote: string func(string s) { /++ // A handy feature of many scripting languages, but not in D // (in D, the type of the or-expression is bool): // The type of the

Re: The D Scripting Language

2010-11-15 Thread Simen kjaeraas
Per Ångström d-n...@autark.se wrote: /++ Simulates type-returning or-expression +/ template or(T) { T _(T a, lazy T b) {T tmp = a; return tmp ? tmp : b;} } You should probably use a function template[1] or at least an eponymous template here: // function template: auto or( T )( T a,

Re: The D Scripting Language

2010-11-15 Thread Per Ångström
On 2010-11-15 18:40, Simen kjaeraas wrote: Per Ångström d-n...@autark.se wrote: /++ Simulates type-returning or-expression +/ template or(T) { T _(T a, lazy T b) {T tmp = a; return tmp ? tmp : b;} } You should probably use a function template[1] or at least an eponymous template here: //

Re: The D Scripting Language

2010-11-15 Thread Daniel Murphy
Per Ångström d-n...@autark.se wrote in message news:ibr8bs$22m...@digitalmars.com... return s || default; I think allowing the second expression in the ternary operator to be omitted would be a better fit for D, and provide the same function. ie. auto x = a ? a : b; auto x = a ? : b; I

Re: The D Scripting Language

2010-11-14 Thread Alexander Malakhov
Leandro Lucarella l...@llucax.com.ar писал(а) в своём письме Sat, 13 Nov 2010 21:13:42 +0600: retard, el 13 de noviembre a las 08:24 me escribiste: void main(string[] args){ import std.stdio; // 1. will not compile void main(string[] args){ writeln(hello); } ...

Re: The D Scripting Language

2010-11-14 Thread Per Ångström
On 2010-11-14 13:40, Alexander Malakhov wrote: Even if there are technical issues, special case for unit tests sounds like a good improvement of usability Another thing that comes to mind about things not allowed in unittest scope that could facilitate unit testing: defining templates. --

Re: The D Scripting Language

2010-11-14 Thread Alexander Malakhov
spir denis.s...@gmail.com писал(а) в своём письме Sat, 13 Nov 2010 16:15:39 +0600: On Fri, 12 Nov 2010 14:42:38 -0500 sybrandy sybra...@gmail.com wrote: 2. Make Windows to open .d files with rdmd by default, so I could run them with simple double-click Yes. Maybe Alexander meant this

Re: The D Scripting Language

2010-11-13 Thread retard
Fri, 12 Nov 2010 23:01:24 +0600, Alexander Malakhov wrote: Gary Whatmore n...@spam.sp писал(а) в своём письме Thu, 11 Nov 2010 20:07:35 +0600: Alexander Malakhov Wrote: ... Maybe it would be better to just make rdmd to surround source code with: //- rdmd generated text BEGIN public

Re: The D Scripting Language -- std imports

2010-11-13 Thread spir
On Fri, 12 Nov 2010 23:21:55 +0600 Alexander Malakhov a...@programmer.net wrote: btw, does --eval make import std.all or some set of modules ? Btw, I just had an idea about std imports -- not only for scripting, but for general use of D as well: What if D automagically imported a std set of

Re: The D Scripting Language

2010-11-13 Thread spir
On Fri, 12 Nov 2010 14:42:38 -0500 sybrandy sybra...@gmail.com wrote: 2. Make Windows to open .d files with rdmd by default, so I could run them with simple double-click You should be able to do this yourself quite easily by right-clicking on the D file and associating it with rdmd.

Re: The D Scripting Language

2010-11-13 Thread sybrandy
On 11/13/2010 05:15 AM, spir wrote: On Fri, 12 Nov 2010 14:42:38 -0500 sybrandysybra...@gmail.com wrote: 2. Make Windows to open .d files with rdmd by default, so I could run them with simple double-click You should be able to do this yourself quite easily by right-clicking on the D file

Re: The D Scripting Language -- std imports

2010-11-13 Thread Nick Sabalausky
spir denis.s...@gmail.com wrote in message news:mailman.322.1289642939.21107.digitalmar...@puremagic.com... On Fri, 12 Nov 2010 23:21:55 +0600 Alexander Malakhov a...@programmer.net wrote: btw, does --eval make import std.all or some set of modules ? Btw, I just had an idea about std imports

Re: The D Scripting Language

2010-11-12 Thread Alexander Malakhov
Gary Whatmore n...@spam.sp писал(а) в своём письме Thu, 11 Nov 2010 20:07:35 +0600: Alexander Malakhov Wrote: ... Maybe it would be better to just make rdmd to surround source code with: //- rdmd generated text BEGIN public import std.stdio, ... void main( string[] args ){ //- rdmd

Re: The D Scripting Language

2010-11-12 Thread Adam D. Ruppe
Alexander Malakhov wrote: import std.stdio; // 1. will not compile I wrote a little rund helper program, and a PHP style D interpreter in another thread a couple days ago, that solves this by a simple string scan. http://arsdnet.net/dcode/rund.d http://arsdnet.net/dcode/dhp.d It scans the

Re: The D Scripting Language

2010-11-12 Thread Alexander Malakhov
Andrei Alexandrescu seewebsiteforem...@erdani.org писал(а) в своём письме Thu, 11 Nov 2010 21:12:33 +0600: On 11/11/10 5:50 AM, Alexander Malakhov wrote: Maybe it would be better to just make rdmd to surround source code with: //- rdmd generated text BEGIN public import std.stdio, ...

Re: The D Scripting Language

2010-11-12 Thread Andrei Alexandrescu
On 11/12/10 9:21 AM, Alexander Malakhov wrote: Andrei Alexandrescu seewebsiteforem...@erdani.org писал(а) в своём письме Thu, 11 Nov 2010 21:12:33 +0600: On 11/11/10 5:50 AM, Alexander Malakhov wrote: Maybe it would be better to just make rdmd to surround source code with: //- rdmd

Re: The D Scripting Language

2010-11-12 Thread Alexander Malakhov
Adam D. Ruppe destructiona...@gmail.com писал(а) в своём письме Fri, 12 Nov 2010 23:13:13 +0600: Alexander Malakhov wrote: import std.stdio; // 1. will not compile I wrote a little rund helper program, and a PHP style D interpreter in another thread a couple days ago, that solves this by

Re: The D Scripting Language

2010-11-12 Thread Alexander Malakhov
Andrei Alexandrescu seewebsiteforem...@erdani.org писал(а) в своём письме Fri, 12 Nov 2010 23:44:18 +0600: On 11/12/10 9:21 AM, Alexander Malakhov wrote: I was unable to pass file to --eval, is this possible ? It is: rdmd --eval $(cat filename) I know... it's cheating :o). But if you

Re: The D Scripting Language

2010-11-12 Thread sybrandy
2. Make Windows to open .d files with rdmd by default, so I could run them with simple double-click You should be able to do this yourself quite easily by right-clicking on the D file and associating it with rdmd. I'd give better instructions except I'm not on a Windows machine right now.

Re: The D Scripting Language

2010-11-12 Thread div0
On 12/11/2010 19:42, sybrandy wrote: 2. Make Windows to open .d files with rdmd by default, so I could run them with simple double-click You should be able to do this yourself quite easily by right-clicking on the D file and associating it with rdmd. I'd give better instructions except I'm

Re: The D Scripting Language

2010-11-12 Thread Andrei Alexandrescu
On 11/12/10 11:42 AM, sybrandy wrote: 2. Make Windows to open .d files with rdmd by default, so I could run them with simple double-click You should be able to do this yourself quite easily by right-clicking on the D file and associating it with rdmd. I'd give better instructions except I'm

Re: The D Scripting Language

2010-11-12 Thread Andrew Wiley
2010/11/12 div0 d...@sourceforge.net On 12/11/2010 19:42, sybrandy wrote: 2. Make Windows to open .d files with rdmd by default, so I could run them with simple double-click You should be able to do this yourself quite easily by right-clicking on the D file and associating it with rdmd.

Re: The D Scripting Language

2010-11-12 Thread sybrandy
On 11/12/2010 03:06 PM, div0 wrote: On 12/11/2010 19:42, sybrandy wrote: 2. Make Windows to open .d files with rdmd by default, so I could run them with simple double-click You should be able to do this yourself quite easily by right-clicking on the D file and associating it with rdmd. I'd

Re: The D Scripting Language

2010-11-12 Thread sybrandy
That sounds good until you think of comparable situations. Python does this, Perl does this, heck, if allowing powerful things to start with an inadvertent click, why do we have batch files? Why do we have executables? Being able to run things by clicking on them is a feature, not a security

the D scripting language -- command line

2010-11-11 Thread spir
[started separate thread] On Thu, 11 Nov 2010 00:58:31 +0100 Tomek Sowiński j...@ask.me wrote: Andrei Alexandrescu napisał: Speaking of getopt, when writing the 'grep' snippet I missed anonymous options a lot: bool h, i; string expr; string[] files; getopt(args, h,h,

Re: the D scripting language -- command line

2010-11-11 Thread ruben niemann
spir Wrote: [started separate thread] On Thu, 11 Nov 2010 00:58:31 +0100 Tomek Sowiński j...@ask.me wrote: Andrei Alexandrescu napisał: Speaking of getopt, when writing the 'grep' snippet I missed anonymous options a lot: bool h, i; string expr; string[] files;

Re: The D Scripting Language

2010-11-11 Thread Steven Schveighoffer
On Wed, 10 Nov 2010 19:12:26 -0500, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: On 11/10/10 3:58 PM, Tomek Sowiński wrote: Andrei Alexandrescu napisał: Speaking of getopt, when writing the 'grep' snippet I missed anonymous options a lot: bool h, i; string expr; string[]

Re: the D scripting language -- command line

2010-11-11 Thread sop
ruben niemann Wrote: spir Wrote: [started separate thread] On Thu, 11 Nov 2010 00:58:31 +0100 Tomek Sowiński j...@ask.me wrote: Andrei Alexandrescu napisał: Speaking of getopt, when writing the 'grep' snippet I missed anonymous options a lot: bool h, i;

Re: the D scripting language -- command line

2010-11-11 Thread Adam Ruppe
spir wrote: I thought once at a default interface between the command-line and a program's startup routine, main(). We could actually do this with a mixin. == int findword (string filename, string word, bool verbose=false) {...} mixin MakeMain!(findword); == And that MakeMain

Re: The D Scripting Language

2010-11-11 Thread Alexander Malakhov
Perhaps a module std.scripting could help quite a lot, too. module std.script; public import std.stdio, std.file, std.process, std.algorithm, ... etc I use at least some of these for most of my programs/scripts. And std.all is probably a bit too heavy. std.script could basically

Re: The D Scripting Language

2010-11-11 Thread Gary Whatmore
Alexander Malakhov Wrote: Perhaps a module std.scripting could help quite a lot, too. module std.script; public import std.stdio, std.file, std.process, std.algorithm, ... etc I use at least some of these for most of my programs/scripts. And std.all is probably a bit too

Re: the D scripting language -- command line

2010-11-11 Thread Lars T. Kyllingstad
On Thu, 11 Nov 2010 13:45:33 +, Adam Ruppe wrote: I actually wrote something that does this already, though my goal was to automate the creation of web apps, it also (used to - I broke it in my last revision) works for command line programs. http://arsdnet.net/dcode/web.d [...] I

Re: The D Scripting Language

2010-11-11 Thread Andrei Alexandrescu
On 11/11/10 5:50 AM, Alexander Malakhov wrote: Perhaps a module std.scripting could help quite a lot, too. module std.script; public import std.stdio, std.file, std.process, std.algorithm, ... etc I use at least some of these for most of my programs/scripts. And std.all is probably a

Re: The D Scripting Language

2010-11-11 Thread sybrandy
Perhaps a module std.scripting could help quite a lot, too. Andrei Also, something I just thought of this morning is to create something similar to std.variant for variables where every variable is the same type. Perl, for example, may store the same value multiple times in the same

Re: The D Scripting Language

2010-11-11 Thread Tomek Sowiński
Steven Schveighoffer napisał: I still don't see added value over the existing situation. Currently getopt leaves whatever wasn't an option in args[1 .. $] (without shuffling order), so the code above would simply use args[1] for expr and args[2 .. $] for files. 1. uses same type

Re: The D Scripting Language

2010-11-11 Thread Tomek Sowiński
sybrandy napisał: Foo x = 27; x += 15; // X is now 42 Foo y = X is ~ x; // Here, x is now treated like a string. std.variant? -- Tomek

Re: the D scripting language -- command line

2010-11-11 Thread Tomek Sowiński
spir napisał: // Let's match assignments. auto args = [program.exe, .*=.*;, file1.d, file2.d, file3.d]; bool h, i; string expr; string[] files; getopt(args, h,h, i,i, expr, files); assert(!h); assert(!i); assert(expr == .*=.*;); assert(files == [file1.d, file2.d, file3.d]); assert(args

Re: The D Scripting Language

2010-11-10 Thread Tomek Sowiński
Andrei Alexandrescu napisał: I'm having trouble thinking of something that would go in this module that wouldn't be a better fit somewhere else. What do you envision? I thought of it for a bit, but couldn't come up with anything :o). I think you're right! Yeah, I think std.all would be

Re: The D Scripting Language

2010-11-10 Thread Stanislav Blinov
Tomek Sowiński wrote: Andrei Alexandrescu napisał: foreach (line; File.byLine(args[1 .. $]) { ... } } I hypothetically made byLine a static method inside File to avoid confusing beginners (one might think on first read that byLine goes line by line through an array of strings). The

Re: The D Scripting Language

2010-11-10 Thread Andrei Alexandrescu
On 11/10/10 1:45 PM, Tomek Sowiński wrote: Andrei Alexandrescu napisał: I'm having trouble thinking of something that would go in this module that wouldn't be a better fit somewhere else. What do you envision? I thought of it for a bit, but couldn't come up with anything :o). I think you're

Re: The D Scripting Language

2010-11-10 Thread Tomek Sowiński
Andrei Alexandrescu napisał: Speaking of getopt, when writing the 'grep' snippet I missed anonymous options a lot: bool h, i; string expr; string[] files; getopt(args, h,h, i,i,expr,files); They can be implemented with relatively little effort. Not getting the example. How would

Re: The D Scripting Language

2010-11-10 Thread Andrei Alexandrescu
On 11/10/10 3:58 PM, Tomek Sowiński wrote: Andrei Alexandrescu napisał: Speaking of getopt, when writing the 'grep' snippet I missed anonymous options a lot: bool h, i; string expr; string[] files; getopt(args, h,h, i,i,expr,files); They can be implemented with relatively little effort.

Re: The D Scripting Language

2010-11-09 Thread Andrei Alexandrescu
On 11/7/10 9:12 PM, Eric Poggel wrote: On 11/7/2010 8:49 PM, Andrei Alexandrescu wrote: On 11/7/10 5:34 PM, Jesse Phillips wrote: Tomek Sowiñski Wrote: This wraps up a thread from a few days ago. Pascal featured my D examples on his Scriptometer site.

Re: The D Scripting Language

2010-11-09 Thread bearophile
Andrei: Someone proposed to add something like http://docs.python.org/library/fileinput.html to Phobos. I think it's a good idea. Good. That someone was me (But I don't use Python fileinput often, so I have never written an enhancement request on this). Bye, bearophile

Re: The D Scripting Language

2010-11-09 Thread Pelle Månsson
On 11/09/2010 06:12 PM, Andrei Alexandrescu wrote: On 11/7/10 9:12 PM, Eric Poggel wrote: On 11/7/2010 8:49 PM, Andrei Alexandrescu wrote: On 11/7/10 5:34 PM, Jesse Phillips wrote: Tomek Sowiñski Wrote: This wraps up a thread from a few days ago. Pascal featured my D examples on his

Re: The D Scripting Language

2010-11-09 Thread Peter Alexander
On 8/11/10 1:49 AM, Andrei Alexandrescu wrote: On 11/7/10 5:34 PM, Jesse Phillips wrote: Tomek Sowiñski Wrote: This wraps up a thread from a few days ago. Pascal featured my D examples on his Scriptometer site. http://rigaux.org/language-study/scripting-language/ D comes 17th out of 28, so

Re: The D Scripting Language

2010-11-09 Thread Gary Whatmore
Pelle Månsson Wrote: On 11/09/2010 06:12 PM, Andrei Alexandrescu wrote: On 11/7/10 9:12 PM, Eric Poggel wrote: On 11/7/2010 8:49 PM, Andrei Alexandrescu wrote: On 11/7/10 5:34 PM, Jesse Phillips wrote: Tomek Sowiñski Wrote: This wraps up a thread from a few days ago. Pascal featured

Re: The D Scripting Language

2010-11-09 Thread Gary Whatmore
Jesse Phillips Wrote: Tomek Sowiñski Wrote: This wraps up a thread from a few days ago. Pascal featured my D examples on his Scriptometer site. http://rigaux.org/language-study/scripting-language/ D comes 17th out of 28, so it's so-so for scripting. -- Tomek When I

Re: The D Scripting Language

2010-11-09 Thread Daniel Gibson
On Wed, Nov 10, 2010 at 2:04 AM, Gary Whatmore n...@spam.sp wrote: I think optimizing this particular test is important for the publicity of D. Once the scripting community acknowledges D, we could redesign it. We should make all current test cases one liners, if possible. I'm dreaming of a

Re: The D Scripting Language

2010-11-07 Thread Jesse Phillips
Tomek Sowiñski Wrote: This wraps up a thread from a few days ago. Pascal featured my D examples on his Scriptometer site. http://rigaux.org/language-study/scripting-language/ D comes 17th out of 28, so it's so-so for scripting. -- Tomek When I looked over his scoring from the

Re: The D Scripting Language

2010-11-07 Thread Andrei Alexandrescu
On 11/7/10 5:34 PM, Jesse Phillips wrote: Tomek Sowiñski Wrote: This wraps up a thread from a few days ago. Pascal featured my D examples on his Scriptometer site. http://rigaux.org/language-study/scripting-language/ D comes 17th out of 28, so it's so-so for scripting. -- Tomek When I

Re: The D Scripting Language

2010-11-07 Thread Eric Poggel
On 11/7/2010 8:49 PM, Andrei Alexandrescu wrote: On 11/7/10 5:34 PM, Jesse Phillips wrote: Tomek Sowiñski Wrote: This wraps up a thread from a few days ago. Pascal featured my D examples on his Scriptometer site. http://rigaux.org/language-study/scripting-language/ D comes 17th out of 28,

Re: The D Scripting Language

2010-11-07 Thread BCS
Hello Tomek, This wraps up a thread from a few days ago. Pascal featured my D examples on his Scriptometer site. http://rigaux.org/language-study/scripting-language/ D comes 17th out of 28, so it's so-so for scripting. The link from D seems dead to me (missing ':' after http).