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 interesti
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 bi
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
spir Wrote:
> On Tue, 16 Nov 2010 09:44:06 +0100
> Per Ã
ngström 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.
> >
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 comp
> "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 doe
"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!")
Daniel Murphy, el 16 de noviembre a las 10:10 me escribiste:
> "Per �ngstr�m" 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 s
On Tue, 16 Nov 2010 09:44:06 +0100
Per Ångström 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 = a ?
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
"Per Ångström" 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 think bearoph
On 2010-11-15 18:40, Simen kjaeraas wrote:
Per Ångström 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:
Per Ångström 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, lazy T b ) {
On 2010-11-15 14:27, spir wrote:
On Mon, 15 Nov 2010 13:15:50 +0100
Per Ångström 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 or-expression is the type
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
On Mon, 15 Nov 2010 13:15:50 +0100
Per Ångström 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 of
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 or-exp
spir писал(а) в своём письме Sat, 13 Nov 2010
16:15:39 +0600:
On Fri, 12 Nov 2010 14:42:38 -0500
sybrandy 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 for users rather than for developpers.
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.
--
Per
Leandro Lucarella писал(а) в своём письме 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");
>}
<...> the 1) p
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");
> > }
> >
> > main(args); // 2. this should be appended, hence anyway rdmd
> should
> > ana
On Sat, Nov 13, 2010 at 4:15 AM, spir wrote:
> On Fri, 12 Nov 2010 14:42:38 -0500
> 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-click
"spir" wrote in message
news:mailman.322.1289642939.21107.digitalmar...@puremagic.com...
>On Fri, 12 Nov 2010 23:21:55 +0600
>"Alexander Malakhov" 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, b
On 11/13/2010 05:15 AM, spir wrote:
On Fri, 12 Nov 2010 14:42:38 -0500
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 w
On Fri, 12 Nov 2010 14:42:38 -0500
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 be
On Fri, 12 Nov 2010 23:21:55 +0600
"Alexander Malakhov" 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
modules, _provid
Fri, 12 Nov 2010 23:01:24 +0600, Alexander Malakhov wrote:
> Gary Whatmore писал(а) в своём письме 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
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
hole.
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 gi
2010/11/12 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
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 no
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 not
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.
Andrei Alexandrescu писал(а) в своём
письме 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 want to pass a file, why not
ju
Adam D. Ruppe писал(а) в своём письме 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 a simple
string scan.
htt
On 11/12/10 9:21 AM, Alexander Malakhov wrote:
Andrei Alexandrescu писал(а) в своём
письме 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
Andrei Alexandrescu писал(а) в своём
письме 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, ...
void main( string[] args ){
/
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 cod
Gary Whatmore писал(а) в своём письме 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 generated te
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
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
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 c
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 "struct
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 bi
Lars T. Kyllingstad wrote:
> Have you ever considered cleaning it up and publishing it as
> a web app library for D, either on dsource or somewhere similar?
Yes, I'd like to do that eventually, but haven't gotten around to it yet. You
can
see, looking through the code, that I've been lax on docum
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
>
> [...]
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
> >
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 fetc
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 temp
ruben niemann Wrote:
> spir Wrote:
>
> > [started separate thread]
> >
> > On Thu, 11 Nov 2010 00:58:31 +0100
> > Tomek SowiÅski wrote:
> >
> > > Andrei Alexandrescu napisaÅ:
> > >
> > > >> Speaking of getopt, when writing the 'grep' snippet I missed anonymous
> > > >> options a lot:
> > >
On Wed, 10 Nov 2010 19:12:26 -0500, Andrei Alexandrescu
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[] files;
getopt(args, "h",&h, "i",&i,
spir Wrote:
> [started separate thread]
>
> On Thu, 11 Nov 2010 00:58:31 +0100
> 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[] fil
[started separate thread]
On Thu, 11 Nov 2010 00:58:31 +0100
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,
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 effor
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 exa
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 r
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 hipotheti
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
On Wed, Nov 10, 2010 at 2:04 AM, Gary Whatmore 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 Linux
>
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.
> >
> > --
>
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 d
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 i
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 Scriptom
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
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.
http://rigaux.org/language-study/scripti
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).
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, so
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 look
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
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.
Thanks for doing this. I think D fares rather well in it.
70 matches
Mail list logo