Andrej Mitrovic wrote:
> On 1/21/11, Jonathan M Davis wrote:
>> Umm. in is never the default. in is essentially an alias for const scope.
>> The
>> default is non-shared and mutable.
>>
>> - Jonathan M Davis
>>
>
> That's what I thought. But I did saw it mentioned in this NG a couple
> of times,
On Thu, 20 Jan 2011 22:02:42 -0500, Andrei Alexandrescu
wrote:
On 1/20/11 7:18 PM, Luke J. West wrote:
Hi to all from a total noob.
first of all, I'd like to say how impressed I am with D. In fact, I keep
pinching myself. Have I *really* found a language worth leaving C++ for
after two deca
On 1/21/11, Jonathan M Davis wrote:
> Umm. in is never the default. in is essentially an alias for const scope.
> The
> default is non-shared and mutable.
>
> - Jonathan M Davis
>
That's what I thought. But I did saw it mentioned in this NG a couple
of times, I can't remember by who though.
In a
On Thursday, January 20, 2011 19:03:09 Andrej Mitrovic wrote:
> import std.stdio;
> import std.traits;
>
> alias ParameterStorageClassTuple STCTuple;
> alias ParameterStorageClass STC;
>
> void foo(in int[] x) { /*x[0] = 5; // This would be a compile-time error*/
> } void bar(int[] x) { x[0] = 5;
On 1/21/11, Andrei Alexandrescu wrote:
> I think copyMembers belongs to the standard library. I wanted to define
> a family of functions like it but never got around to it.
>
It's a shame we can't use .dup. It would look really nice in code.
Ah, damnit, Andrei beat me to the punch!
Well, at least his methods make much more sense than my little hacks.
Be afraid.. be very afraid!
import std.algorithm;
import std.stdio;
import std.conv;
enum fields = [__traits(allMembers, Foo)];
string populateFields(string[] haystack)
{
string result;
while (haystack.length > 0)
{
switch (haystack[0])
{
case "__ctor":
On 1/20/11 7:18 PM, Luke J. West wrote:
Hi to all from a total noob.
first of all, I'd like to say how impressed I am with D. In fact, I keep
pinching myself. Have I *really* found a language worth leaving C++ for
after two decades? It's beginning to look that way. Obviously I'm
devouring the 2.
import std.stdio;
import std.traits;
alias ParameterStorageClassTuple STCTuple;
alias ParameterStorageClass STC;
void foo(in int[] x) { /*x[0] = 5; // This would be a compile-time error*/ }
void bar(int[] x) { x[0] = 5; }
void main()
{
assert(STCTuple!foo[0] == STC.NONE);
assert(STCTuple
On Thursday, January 20, 2011 17:18:48 Luke J. West wrote:
> Hi to all from a total noob.
>
> first of all, I'd like to say how impressed I am with D. In fact, I keep
> pinching myself. Have I *really* found a language worth leaving C++ for
> after two decades? It's beginning to look that way. Obv
On Thursday, January 20, 2011 16:12:58 Tomek Sowiński wrote:
> Doing my own deeds, I often found myself in need of writing up a range just
> to e.g. feed it into an algorithm. Problem is, defining even the simplest
> range -- one-pass forward -- is verbose enough to render this (correct)
> approach
On Thursday, January 20, 2011 16:19:54 bearophile wrote:
> Tomek Sowiñski:
> > auto range(T, Whatever)(lazy bool _empty, lazy Whatever _popFront, lazy T
> > _front) {
>
> I am not sure, but I think Andrei has deprecated the "lazy" attribute.
In general or on a specific function? I'm pretty sure t
BlazingWhitester wrote:
I spotted some patents that can theaten current DMD implementation.
Wanted to clarify things.
http://www.freepatentsonline.com/6185728.pdf - this patent describes
method pointers implementation (delegates)
This was obviously a patent aimed at protecting Delphi from VB.
Welcome!
On 01/20/2011 07:18 PM, Luke J. West wrote:
how do I, in c++ speak, do the D for...
A b(a); // or if you prefer...
A* b = new A(a);
try
A b = new A(a);
I'm sure this must be trivial.
Many many thanks,
Luke
Hi to all from a total noob.
first of all, I'd like to say how impressed I am with D. In fact, I keep
pinching myself. Have I *really* found a language worth leaving C++ for
after two decades? It's beginning to look that way. Obviously I'm
devouring the 2.0 documentation right now, but have not ye
bearophile napisał:
> I am not sure, but I think Andrei has deprecated the "lazy" attribute.
Yes, but AFAIR in favor of implicit conversions of expressions to parameterless
delegates, which strengthens my little idiom.
--
Tomek
Tomek Sowiñski:
> auto range(T, Whatever)(lazy bool _empty, lazy Whatever _popFront, lazy T
> _front) {
I am not sure, but I think Andrei has deprecated the "lazy" attribute.
Bye,
bearophile
Doing my own deeds, I often found myself in need of writing up a range just to
e.g. feed it into an algorithm. Problem is, defining even the simplest range --
one-pass forward -- is verbose enough to render this (correct) approach
unprofitable.
This is how I went about the problem:
auto range(
The ATS language contains a metric ton of nice ideas. ATS programs are
sometimes faster than C ones (because its type system allows to avoid some
runtime tests done in C programs, allows some higher order optimizations, etc)
despite the programmer has ways to write them in much safer way than C
Andrei Alexandrescu Wrote:
> I'm consolidating some routines from std.string into std.array. They are
> specialized for operating on arrays, and include the likes of insert,
> remove, replace.
>
> One question is whether operations should be performed in place or on a
> copy. For example:
>
>
Is it ok to use:
In place:
trim( string )
replace( string, from, to )
or Copy:
trim( string, outstring )
replace( string, from, to, outstring )
On 01/20/2011 12:33 AM, Andrei Alexandrescu wrote:
I'm consolidating some routines from std.string into std.array. They are
specialized for operating on arrays, and include the likes of insert,
remove, replace.
One question is whether operations should be performed in place or on a
copy. For exa
On 01/20/2011 11:31 AM, bearophile wrote:
> Andrej Mitrovic:
>
>> I think what might help out in D is if we had a way to mark some
>> functions so the compiler guarantees that their return values *are
>> not* to be discarded. For example, this code will compile:
>>
>> import std.stdio;
>> import s
On 17/01/11 6:18 PM, Ary Manzana wrote:
Thanks. I searched it in wordrefence and "define:redux" and "what is redux" in
Google with no luck.
The definition is the first answer on Google for both those searches :-)
Jeff Nowakowski Wrote:
> On 01/20/2011 07:33 AM, Gour wrote:
> > On Thu, 20 Jan 2011 06:39:08 -0500
> > Jeff Nowakowski wrote:
> >
> >
> >> No, I haven't tried it. I'm not going to try every OS that comes down
> >> the pike.
> >
> > Then please, without any offense, do not give advises about some
Andrei Alexandrescu wrote:
> On 1/20/11 12:47 PM, Jens Mueller wrote:
> >Andrei Alexandrescu wrote:
> >>On 1/19/11 7:19 PM, Jens Mueller wrote:
> >>>Andrei Alexandrescu wrote:
> Place the call to not!alwaysTrue in a local function inside main:
>
> bool alwaysFalse(uint a) { return
On 1/20/11, Jonathan M Davis wrote:
> On Thursday 20 January 2011 03:51:48 Trass3r wrote:
>> If such an annotation was introduced, it should be the other way around.
>> But imo discarding a return value should always result in a warning,
>> the function returns something for a reason.
>
> Actually
That looks like a similar issue. Thanks!
On Thursday, January 20, 2011 11:33:38 Adrian Mercieca wrote:
> Hi guys,
>
> Ok - thanks for your answers.
>
> So, I will get TDPL book - all reviewers on amazon are raving about it.
>
> As for the Phobos class library (coz that is the D2 standard lib no?), how
> can I get to grips with that? Do
On Thursday, January 20, 2011 05:48:12 so wrote:
> > auto newStr = replace(str, "hello", "world");
> > replaceInPlace(newStr, "world", "hello");
> >
> > it's quite clear that the first one returns a value and the the second
> > one does
> > it in place. Whereas if you have
> >
> > auto newStr = r
On 1/20/11 12:47 PM, Jens Mueller wrote:
Andrei Alexandrescu wrote:
On 1/19/11 7:19 PM, Jens Mueller wrote:
Andrei Alexandrescu wrote:
Place the call to not!alwaysTrue in a local function inside main:
bool alwaysFalse(uint a) { return not!alwaysTrue(a); }
Thanks. Can you elaborate a bi
Adrian Mercieca:
> As for the Phobos class library (coz that is the D2 standard lib no?), how
> can I get to grips with that? Does the book cover that? Or does the book
> just cover the core language?
> Is there some online material for Phobos?
Phobos is a work in progress, TDPL doesn't cover i
Hi guys,
Ok - thanks for your answers.
So, I will get TDPL book - all reviewers on amazon are raving about it.
As for the Phobos class library (coz that is the D2 standard lib no?), how
can I get to grips with that? Does the book cover that? Or does the book
just cover the core language?
Is th
On 2011-01-20 15:58, Adam Ruppe wrote:
When you compile, you have to provide a path anyhow, less hostile to
user and you don't have to change the code.
One of the things implicit in the thread now is removing the
need to provide a path - the compiler can (usually) figure it
out on its own. Try
On 2011-01-20 13:12, Daniel Gibson wrote:
Am 20.01.2011 00:54, schrieb Adam D. Ruppe:
Jesse Phillips wrote:
You can have the author release packaged libraries for developers
to use and the author should do this. So this begs the question of
what is the repository for?
It's so you have a varie
On 2011-01-20 10:19, Gour wrote:
On Wed, 19 Jan 2011 19:40:49 +0100
Jacob Carlborg wrote:
1. it uses python, yet another dependency
True, but it brings more features over e.g. cmake 'cause you have full
language on disposal.
I would go with a tool that uses a dynamic language as a DSL. I'm
Probably related to http://d.puremagic.com/issues/show_bug.cgi?id=5460
bearophile wrote:
I think for a newcomer the most difficult part is related to tuples:
* find them (in std.typecons!!!)
* catch after much time, pains, research, they should not even try to
construct a tuple using Tuple!, but using the convenience tuple() func
instead.
I agree that like dynam
Am 20.01.2011 19:42, schrieb Sean Eskapp:
In code like this:
import std.stdio;
struct foo
{
int val;
static immutable bar = foo(1);
this(int val)
{
this.val = 50;
}
}
void main()
{
writeln(foo.bar.val);
}
The user-defined struc
Andrei Alexandrescu wrote:
> On 1/19/11 7:19 PM, Jens Mueller wrote:
> >Andrei Alexandrescu wrote:
> >>Place the call to not!alwaysTrue in a local function inside main:
> >>
> >> bool alwaysFalse(uint a) { return not!alwaysTrue(a); }
> >
> >Thanks. Can you elaborate a bit please? I wonder why t
In code like this:
import std.stdio;
struct foo
{
int val;
static immutable bar = foo(1);
this(int val)
{
this.val = 50;
}
}
void main()
{
writeln(foo.bar.val);
}
The user-defined struct constructor is not called, because it's ov
Thu, 20 Jan 2011 13:33:58 +0100, Gour wrote:
> On Thu, 20 Jan 2011 06:39:08 -0500
> Jeff Nowakowski wrote:
>
>
>> No, I haven't tried it. I'm not going to try every OS that comes down
>> the pike.
>
> Then please, without any offense, do not give advises about something
> which you did not try
Russel Winder wrote:
> On Thu, 2011-01-20 at 12:32 +0100, Gour wrote:
>> On Thu, 20 Jan 2011 10:13:00 +
>> Russel Winder wrote:
>>
>> > SCons, Waf, and Gradle are currently the tools of choice.
>>
>> Gradle is (mostly) for Java-based projects, afaict?
>
> It is the case that there are two
spir:
> Yes, this is the only nice looking, high-level, and D-style solution.
I have added:
http://d.puremagic.com/issues/show_bug.cgi?id=5466
> While I by far prefer avoiding stringcode:
> auto r = map!((p) (tuple(p[0]*10, p[1]~p[1])) (aa.byPair());
> where p means pair; should be corre
so:
> I don't understand how the first two are clear and the last two are not so.
> Where both have the name "replace" for different things, and replace to me
> means "replace in place".
> With this in hand, how is the first "replace" is quite clear?
In Python I am used to immutable strings, so
so:
> I didn't know that, this solution is what i meant.
> So, they didn't blindly enforce functional language rules to a
> non-functional language.
Python was designed lot of time ago by Guido that I think didn't know much
about functional programming. So they have first added an in-place sor
Don:
> If you don't use the return value of a strongly pure, nothrow function,
> you could be given a 'expression has no effect' error.
> Currently the function call is silently dropped.
I have added this at the end of the enhancement request 5464 (but the error
message is different).
Bye,
bea
Delegates cannot be cast from one type to another, even if the only difference
in type is the qualifiers on value type parameters. However, the same code
works fine with functions instead of delegates, as such:
import std.stdio;
void foo(void function(int) bar)
{
bar(5);
}
void foobar(vo
Steven Schveighoffer wrote:
On Thu, 20 Jan 2011 10:36:00 -0500, foobar wrote:
Jonathan M Davis Wrote:
On Thursday 20 January 2011 03:51:48 Trass3r wrote:
> If such an annotation was introduced, it should be the other way
around.
> But imo discarding a return value should always result in a
On Thu, 20 Jan 2011 10:36:00 -0500, foobar wrote:
Jonathan M Davis Wrote:
On Thursday 20 January 2011 03:51:48 Trass3r wrote:
> If such an annotation was introduced, it should be the other way
around.
> But imo discarding a return value should always result in a warning,
> the function ret
Jonathan M Davis Wrote:
> On Thursday 20 January 2011 03:51:48 Trass3r wrote:
> > If such an annotation was introduced, it should be the other way around.
> > But imo discarding a return value should always result in a warning,
> > the function returns something for a reason.
>
> Actually, there
On Thu, 20 Jan 2011 09:58:17 -0500, Adam Ruppe
wrote:
When you compile, you have to provide a path anyhow, less hostile to
user and you don't have to change the code.
One of the things implicit in the thread now is removing the
need to provide a path - the compiler can (usually) figure it
o
> When you compile, you have to provide a path anyhow, less hostile to
> user and you don't have to change the code.
One of the things implicit in the thread now is removing the
need to provide a path - the compiler can (usually) figure it
out on its own. Try dmd -v and search for import lines.
B
On Thu, 20 Jan 2011 09:19:54 -0500
Jeff Nowakowski wrote:
> Please yourself. I quoted from the FAQ from the distribution's main
> site. If that's wrong, then Arch has a big public relations problem.
Arch simply does not offer false promises that system will "Just
work". Still, I see the number
On Thu, 20 Jan 2011 16:30:40 +0200, Adam Ruppe
wrote:
IMO the best way to do that would be to get everyone in the habit
of including the version in their modules.
module random.garbage.0.6;
import random.garbage.0.6;
Even better, we could enforce this to only module writers.
module rando
On 01/20/2011 02:19 AM, Jens Mueller wrote:
Thanks. Can you elaborate a bit please? I wonder why the alias won't
work.
Because in your original version the alias line does not define a func,
but a kind of constant symbol. A higher order func like filter expects a
func as first arg, not a cons
On 01/20/2011 11:12 AM, bearophile wrote:
> And I suggest to add a third associative array member function that
returns a range of key,value tuples, as in Python3. This allows to solve
the task like this:
> auto r = map!q{ tuple(a[0]*10, a[1]~a[1]) }(aa.byPair());
Yes, this is the only nice lo
In the meantime the world is going more functional... :-)
I love how they solve this problem, but if you go on that path while
ignoring the reality there wouldn't be much of a reason using D, no? :)
> However, when there are breaking changes, random.garbage needs a new
version (e.g. 0.6.etc instead of 0.5.etc).
IMO the best way to do that would be to get everyone in the habit
of including the version in their modules.
module random.garbage.0.6;
import random.garbage.0.6;
That way, it is e
On 20/01/11 10:33, Andrei Alexandrescu wrote:
I'm consolidating some routines from std.string into std.array. They are
specialized for operating on arrays, and include the likes of insert,
remove, replace.
One question is whether operations should be performed in place or on a
copy. For example:
On 01/20/2011 07:33 AM, Gour wrote:
On Thu, 20 Jan 2011 06:39:08 -0500
Jeff Nowakowski wrote:
No, I haven't tried it. I'm not going to try every OS that comes down
the pike.
Then please, without any offense, do not give advises about something
which you did not try. I did use Ubuntu...
Pl
You have to think of the normal sort as a performance hack, something
that is good because copying data wastes a lot of time, if the array is
large or if you have to sort an many small arrays. Normally in Python
you prefer sorted(), that returns a sorted copy, unless performance is
importan
Am 20.01.2011 14:48, schrieb Adam Ruppe:
Pre-built libs aren't all that useful anyway, for several reasons:
By "pre-built" I mean all the source is in one place, so the
compile Just Works, not necessarily being pre-compiled.
So if you downloaded mylib.zip, every file it needs is in there. No
n
> Pre-built libs aren't all that useful anyway, for several reasons:
By "pre-built" I mean all the source is in one place, so the
compile Just Works, not necessarily being pre-compiled.
So if you downloaded mylib.zip, every file it needs is in there. No
need to separately hunt down random.garbage
auto newStr = replace(str, "hello", "world");
replaceInPlace(newStr, "world", "hello");
it's quite clear that the first one returns a value and the the second
one does
it in place. Whereas if you have
auto newStr = replaceCopy(str, "hello", "world");
replace(newStr, "world", "hello");
the fi
On Thu, Jan 20, 2011 at 5:39 AM, Jeff Nowakowski wrote:
> On 01/20/2011 12:24 AM, Gour wrote:
>
>> Otoh, with Ubuntu, upgrade from 8.10 to 10.10 is always a major
>> undertaking (I'm familiar with it since '99 when I used SuSE and had
>> experience with deps hell.)
>>
>
> Highlighting the proble
On Thu, 20 Jan 2011 06:39:08 -0500
Jeff Nowakowski wrote:
> No, I haven't tried it. I'm not going to try every OS that comes down
> the pike.
Then please, without any offense, do not give advises about something
which you did not try. I did use Ubuntu...
> So instead of giving you a bunch of
Andrej Mitrovic:
> If the replace function is marked with some kind of @nodiscard
> annotation, then his would be a compile error since it doesn't make
> sense to construct a new string, return it, and discard it.
http://d.puremagic.com/issues/show_bug.cgi?id=5464
Bye,
bearophile
Am 20.01.2011 00:54, schrieb Adam D. Ruppe:
Jesse Phillips wrote:
You can have the author release packaged libraries for developers
to use and the author should do this. So this begs the question of
what is the repository for?
It's so you have a variety of libraries available at once with
mini
On Thursday 20 January 2011 03:39:08 Jeff Nowakowski wrote:
> On 01/20/2011 12:24 AM, Gour wrote:
> > I've feeling that you just copied the above from FAQ and never
> > actually tried Archlinux.
>
> No, I haven't tried it. I'm not going to try every OS that comes down
> the pike. If the FAQ says t
On Thu, 2011-01-20 at 12:32 +0100, Gour wrote:
> On Thu, 20 Jan 2011 10:13:00 +
> Russel Winder wrote:
>
> > SCons, Waf, and Gradle are currently the tools of choice.
>
> Gradle is (mostly) for Java-based projects, afaict?
It is the case that there are two more or less distinct domains of b
On Thursday 20 January 2011 03:51:48 Trass3r wrote:
> If such an annotation was introduced, it should be the other way around.
> But imo discarding a return value should always result in a warning,
> the function returns something for a reason.
Actually, there are plenty of cases where you throw a
If such an annotation was introduced, it should be the other way around.
But imo discarding a return value should always result in a warning,
the function returns something for a reason.
> If you have replace(str, "hello", "world");
> you don't know whether it's changed the value in place or if you're
throwing away a return value. However, if you have
> auto newStr = replace(str, "hello", "world");
> replaceInPlace(newStr, "world", "hello");
> it's quite clear that the first one re
On 01/20/2011 12:24 AM, Gour wrote:
I've feeling that you just copied the above from FAQ and never
actually tried Archlinux.
No, I haven't tried it. I'm not going to try every OS that comes down
the pike. If the FAQ says that you're going to have to be more of an
expert with your system, the
On Thu, 20 Jan 2011 10:13:00 +
Russel Winder wrote:
> SCons, Waf, and Gradle are currently the tools of choice.
Gradle is (mostly) for Java-based projects, afaict?
Sincerely,
Gour
--
Gour | Hlapicina, Croatia | GPG key: CDBF17CA
Am 20.01.2011 11:19, schrieb spir:
On 01/19/2011 10:09 PM, retard wrote:
Wed, 19 Jan 2011 15:44:38 -0500, Nick Sabalausky wrote:
"Andrej Mitrovic" wrote in message
news:mailman.724.1295465996.4748.digitalmar...@puremagic.com...
Or pack your bags and move to Europe. :p
I thought Europe was g
Andrej Mitrovic:
> I think what might help out in D is if we had a way to mark some
> functions so the compiler guarantees that their return values *are
> not* to be discarded. For example, this code will compile:
>
> import std.stdio;
> import std.string;
> void main()
> {
> string s = "Mary
On 01/19/2011 10:09 PM, retard wrote:
Wed, 19 Jan 2011 15:44:38 -0500, Nick Sabalausky wrote:
"Andrej Mitrovic" wrote in message
news:mailman.724.1295465996.4748.digitalmar...@puremagic.com...
Or pack your bags and move to Europe. :p
I thought Europe was getting software patents?
It's the
Simen kjaeraas:
> byKey is essentially an opApply. You have to wrap it in a fiber to make it
> work with the range interface:
Thank you for all your code and work.
I have found a bug (it's not a bug of yours): if I compile your code with
-release, DMD prints:
test.d(45): Error: function D main i
I missed a lot of this thread and coming in part way through may miss
lots of past nuances, or even major facts.
On Thu, 2011-01-20 at 10:19 +0100, Gour wrote:
> On Wed, 19 Jan 2011 19:40:49 +0100
> Jacob Carlborg wrote:
>
> > 1. it uses python, yet another dependency
>
> True, but it brings mo
On Wed, 19 Jan 2011 19:40:49 +0100
Jacob Carlborg wrote:
> 1. it uses python, yet another dependency
True, but it brings more features over e.g. cmake 'cause you have full
language on disposal.
> 2. it seems complicated
Well, build systems are complex... ;)
Sincerely,
Gour
--
Gour | Hlap
In digitalmars.D, you wrote:
> The two most frustrating aspects were documentation and deployment.
> The documents were sparse and useless and deployment was the
> hugest headache I've ever experienced, in great part due to Rubygems
> not working properly!
>
> They've probably improved it a lot sin
On 2011-01-19 21:13, Adam Ruppe wrote:
Vladimir Panteleev wrote:
Your tool will just download the latest version of Y and the
whole thing crashes and burns.
My problem is I don't see how that'd happen in the first place. Who
would distribute something they've never compiled?
If they compiled
On Wed, 2011-01-19 at 22:37 +0100, Simen kjaeraas wrote:
> Nick Sabalausky wrote:
>
> > "retard" wrote in message
> > news:ih7jv4$q49$7...@digitalmars.com...
> >> Wed, 19 Jan 2011 15:44:38 -0500, Nick Sabalausky wrote:
> >>
> >>> "Andrej Mitrovic" wrote in message
> >>> news:mailman.724.1295465
85 matches
Mail list logo