On Mon, 08 Mar 2010 16:42:54 -0500, Philippe Sigaud
wrote:
On Mon, Mar 8, 2010 at 14:22, Steven Schveighoffer
wrote:
The shrinkToFit name is not my favorite, anyone care to submit a better
name? minimize is out because it has connotations of math already.
minCapacity
minimizeCapacity
To try the new operators I have created this helper that works:
auto operators(string[] items...) {
struct Bunch {
string[] items;
bool opBinaryRight(string s:"in")(string item) {
foreach (el; items)
if (el == item)
return true;
Trass3r wrote:
obj2asm tells the tale. (obj2asm is an incredibly useful tool, I
don't know why nobody uses it.)
Maybe because it's not free (and not much advertised). obconv also
supports disassembling various object file formats + conversion
between them and it's open source:
http://www.agner
On 08/03/10 23:35, Andrei Alexandrescu wrote:
Man I can't wait for that book to be out.
I suspect you're not the only one, I was filled with excitement when I
saw the expected delivery date become earlier a few days ago, I'm
eagerly awaiting it so I can start playing with D2 properly rather t
Philippe Sigaud:
> >writeln(typeid(typeof(a.init))); // prints: int
> >
>
> ?! You mean typeof(a) != typeof((typeof(a)).init) ?!
>
> Ugh... I thought (int[2]).init was [0,0] and in general (T[n]).init was
> [(T.init) n times]
http://d.puremagic.com/issues/show_bug.cgi?id=3826
Bye,
bearophi
Robert Clipsham wrote:
On 08/03/10 22:53, Andrei Alexandrescu wrote:
What I usually do is:
T foo(T)(T s) if (is(typeof(s + s))) {
}
Andrei
That's far nicer, I keep forgetting about is(typeof()), thanks :)
It'll be hard to forget once TDPL will be out there, the idiom is
present in several
>writeln(typeid(typeof(a.init))); // prints: int
>
?! You mean typeof(a) != typeof((typeof(a)).init) ?!
Ugh... I thought (int[2]).init was [0,0] and in general (T[n]).init was
[(T.init) n times]
>writeln(foo(a)); // test.d(14): Error: Array operation s + s not
> implemented
> }
>
>
> B
On 08/03/10 22:53, Andrei Alexandrescu wrote:
What I usually do is:
T foo(T)(T s) if (is(typeof(s + s))) {
}
Andrei
That's far nicer, I keep forgetting about is(typeof()), thanks :)
Andrei Alexandrescu:
> > I'll also point out that AAs have a default policy that is much more
> > reasonable.
>
> I guess that should be changed too :o).
-.-
Bye,
bearophile
Andrei Alexandrescu:
> What I usually do is:
> T foo(T)(T s) if (is(typeof(s + s))) {
> }
Nice, thank you, I'll use that.
(That solution too presents the bug 3903)
Bye,
bearophile
> But now I don't know what's happening, because that trait correctly returns
> false, but the compiler generates a compile error at line 14 still. I think
> there's a new bug.
I have added a bug:
http://d.puremagic.com/issues/show_bug.cgi?id=3903
Bye,
bearophile
Robert Clipsham:
> Untested, will the following do what you need?
>
> T foo(T)(T s) if (__traits(compiles, {return s + s;})) {
> return s + s;
> }
>
> Seems like you may as well test if you can add what you're passed rather
> than the initial value for the type.
Oh, nice, I didn't
Robert Clipsham wrote:
On 08/03/10 22:03, bearophile wrote:
2) What's the best way to translate this to the new operator regime?
T foo(T)(T s) if (__traits(hasMember, T, "opAdd")) {
return s + s;
}
I have not found a good solution yet. This solution looks buggy (also
because fixed-sized
Steven Schveighoffer wrote:
On Mon, 08 Mar 2010 15:56:14 -0500, Andrei Alexandrescu
wrote:
Steven Schveighoffer wrote:
On Mon, 08 Mar 2010 14:49:33 -0500, Andrei Alexandrescu
wrote:
bearophile wrote:
Andrei Alexandrescu:
Sorry, this stays.
Then I'm not going to use the Phobos printi
On 08/03/10 22:03, bearophile wrote:
2) What's the best way to translate this to the new operator regime?
T foo(T)(T s) if (__traits(hasMember, T, "opAdd")) {
return s + s;
}
I have not found a good solution yet. This solution looks buggy (also because
fixed-sized arrays have a buggy .in
Trass3r wrote:
The linux version comes in the zip right along side dmd.
Indeed. Even the OSX folder contains obj2asm. The windows version is missing.
The best thing is, on Linux you can use binutils objdump just fine. I'm
sure OSX has tools to inspect object files as well. Only on Windows,
On Mon, 08 Mar 2010 15:56:14 -0500, Andrei Alexandrescu
wrote:
Steven Schveighoffer wrote:
On Mon, 08 Mar 2010 14:49:33 -0500, Andrei Alexandrescu
wrote:
bearophile wrote:
Andrei Alexandrescu:
Sorry, this stays.
Then I'm not going to use the Phobos printing in all my future D2
prog
> 2) What's the best way to translate this to the new operator regime?
>
> T foo(T)(T s) if (__traits(hasMember, T, "opAdd")) {
> return s + s;
> }
I have not found a good solution yet. This solution looks buggy (also because
fixed-sized arrays have a buggy .init):
import std.stdio: writel
> The linux version comes in the zip right along side dmd.
>
Indeed. Even the OSX folder contains obj2asm. The windows version is missing.
On Mon, Mar 8, 2010 at 14:22, Steven Schveighoffer wrote:
> The shrinkToFit name is not my favorite, anyone care to submit a better
> name? minimize is out because it has connotations of math already.
>
minCapacity
minimizeCapacity
shrinkCapacity
shrink (just shrink)
releaseCapacity
compacify
fi
I think this bug has been squished as well. Both test cases now compile
fine.
http://d.puremagic.com/issues/show_bug.cgi?id=3694
Walter Bright wrote:
Lots of meat and potatoes here, and a cookie! (spelling checker for
error messages)
http://www.digitalmars.com/d/1.0/changelog.html
http://ftp.
On Mon, Mar 08, 2010 at 04:12:00PM -0500, Trass3r wrote:
> Maybe because it's not free (and not much advertised).
The linux version comes in the zip right along side dmd.
--
Adam D. Ruppe
http://arsdnet.net
> obj2asm tells the tale. (obj2asm is an incredibly useful tool, I don't
> know why nobody uses it.)
>
Maybe because it's not free (and not much advertised).
obconv also supports disassembling various object file formats + conversion
between them and it's open source: http://www.agner.org/optim
Steven Schveighoffer wrote:
On Mon, 08 Mar 2010 14:49:33 -0500, Andrei Alexandrescu
wrote:
bearophile wrote:
Andrei Alexandrescu:
Sorry, this stays.
Then I'm not going to use the Phobos printing in all my future D2
programs. As I was not using it in D1. I'm not going to change idea
on th
Steven Schveighoffer:
> For completely unambiguous, yes. But still, I find often that quotes are
> more noise than they are worth when just doing simple printouts. What we
> want is the most useful default.
Quotes add a bit of noise, but I prefer to tell apart the cases of two strings
from
On Mon, 08 Mar 2010 15:12:24 -0500, bearophile
wrote:
Steven Schveighoffer:
Tell me how you would parse the following text serialization string for
a
string[]:
hello world how are you
What if it was a string[][]?
Compare that to:
[hello world, [how are, you]]
You are missing somethin
Andrei Alexandrescu:
> Your choice of leading/trailing symbols and of separators makes 'to'
> friendlier for printing e.g. debug strings. My choice makes it a
> primitive for text serialization. I'm not 100% sure which is the more
> frequent use and therefore which is the most appropriate as a d
Don wrote:
Bug 1914 Array initialisation from const array yields memory trample
was fixed, in D2 only. Can we get this into D1 as well?
The problem is I don't think it's the right fix, and I haven't spent the
time figuring it out yet.
bearophile wrote:
Note: this produces the same very large binary, I don't know why:
double[100_000] arr = void;
static this() {
arr[] = typeof(arr[0]).init;
}
void main() {}
obj2asm tells the tale. (obj2asm is an incredibly useful tool, I don't
know why nobody uses it.)
double[100_00
Steven Schveighoffer:
> Tell me how you would parse the following text serialization string for a
> string[]:
>
> hello world how are you
>
> What if it was a string[][]?
>
> Compare that to:
>
> [hello world, [how are, you]]
You are missing something:
["hello world", ["how are", "you"]]
:
bearophile wrote:
While this hangs my compiler, I don't know why:
double[100_000] arr = 0.0;
static this() {
arr[] = typeof(arr[0]).init;
}
void main() {}
Well, it didn't hang, it just took a while. I found the problem.
On Mon, 08 Mar 2010 14:49:33 -0500, Andrei Alexandrescu
wrote:
bearophile wrote:
Andrei Alexandrescu:
Sorry, this stays.
Then I'm not going to use the Phobos printing in all my future D2
programs. As I was not using it in D1. I'm not going to change idea
on this.
(e.g. the comma may be
Steven Schveighoffer wrote:
On Mon, 08 Mar 2010 14:27:36 -0500, Andrei Alexandrescu
wrote:
bearophile wrote:
Andrei Alexandrescu:
$(LI std.conv: changed the default array formatting from "[a, b,
c]" to "a b c")
That's a regression!!!
(And I think in the past it was [a,b,c] instead of
bearophile wrote:
Andrei Alexandrescu:
Sorry, this stays.
Then I'm not going to use the Phobos printing in all my future D2
programs. As I was not using it in D1. I'm not going to change idea
on this.
(e.g. the comma may be a decimal point in some languages, so is
[1,2] in a German locale
Steven Schveighoffer wrote:
On Mon, 08 Mar 2010 14:27:36 -0500, Andrei Alexandrescu
wrote:
bearophile wrote:
Andrei Alexandrescu:
$(LI std.conv: changed the default array formatting from "[a, b,
c]" to "a b c")
That's a regression!!!
(And I think in the past it was [a,b,c] instead of
Andrei Alexandrescu:
> Sorry, this stays.
Then I'm not going to use the Phobos printing in all my future D2 programs. As
I was not using it in D1. I'm not going to change idea on this.
>(e.g. the comma may be a decimal point in some languages, so is [1,2] in a
>German locale an array of doubl
On Mon, 08 Mar 2010 14:27:36 -0500, Andrei Alexandrescu
wrote:
bearophile wrote:
Andrei Alexandrescu:
$(LI std.conv: changed the default array formatting from "[a, b, c]"
to "a b c")
That's a regression!!!
(And I think in the past it was [a,b,c] instead of [a, b, c], because
it's bett
If you compile a program like this:
double[100_000] arr;
void main() {}
With dmd you produce a binary about 1 MB in size, because doubles in D are not
filled with zero.
So for n-D arrays bigger than a certain amount of memory, can DMD compile that
code with a zero initialization plus filling o
bearophile wrote:
Andrei Alexandrescu:
$(LI std.conv: changed the default array formatting from "[a, b, c]" to
"a b c")
That's a regression!!!
(And I think in the past it was [a,b,c] instead of [a, b, c], because it's
better to save some screen space, it costs a lot!).
Sorry, this stays. T
Walter Bright wrote:
Lots of meat and potatoes here, and a cookie! (spelling checker for
error messages)
http://www.digitalmars.com/d/1.0/changelog.html
http://ftp.digitalmars.com/dmd.1.057.zip
http://www.digitalmars.com/d/2.0/changelog.html
http://ftp.digitalmars.com/dmd.2.041.zip
Thanks to
Andrei Alexandrescu:
> $(LI std.conv: changed the default array formatting from "[a, b, c]" to
> "a b c")
That's a regression!!!
(And I think in the past it was [a,b,c] instead of [a, b, c], because it's
better to save some screen space, it costs a lot!).
Bye,
bearophile
Walter Bright wrote:
Lots of meat and potatoes here, and a cookie! (spelling checker for
error messages)
http://www.digitalmars.com/d/1.0/changelog.html
http://ftp.digitalmars.com/dmd.1.057.zip
http://www.digitalmars.com/d/2.0/changelog.html
http://ftp.digitalmars.com/dmd.2.041.zip
Thanks to
Walter Bright wrote:
Lots of meat and potatoes here, and a cookie! (spelling checker for
error messages)
http://www.digitalmars.com/d/1.0/changelog.html
http://ftp.digitalmars.com/dmd.1.057.zip
http://www.digitalmars.com/d/2.0/changelog.html
http://ftp.digitalmars.com/dmd.2.041.zip
Thanks to
> __traits allMembers and and derivedMembers now return a tuple of strings
> rather
> than an array of strings. Enclose __traits in [ ] to make array literal. This
> makes it
> possible for foreach statements to iterate at compile time over it.
How exciting!
On 3/8/10, Trass3r wrote:
> Is ther
Is there a better way to use the new operator overloading than string mixins?
Also the following code strangely yields:
dsfml\system\vector2.d(47): Error: variable
dsfml.system.vector2.Vector2!(float).Vector2.op only parameters or foreach
declarations can be ref
/// element-wise operations, +,
bearophile wrote:
Ary Borenszweig:
I'm normally interested to enter the if branch if x is not null and it
has an interesting value. For example, if I implement a String class I
would implement it as not being empty. But I think the biggest problem
is making a different semantic for this to str
Ary Borenszweig:
> I'm normally interested to enter the if branch if x is not null and it
> has an interesting value. For example, if I implement a String class I
> would implement it as not being empty. But I think the biggest problem
> is making a different semantic for this to structs and cla
Ary Borenszweig:
> And isn't it better for the spellchecker to show the closest match using
> levenshtein distance instead of just distance 1?
Walter is an engineer, and follows the KISS principle, he likes to use the
simpler thing that can possibly work (especially in the first version of
some
On Mon, 08 Mar 2010 01:54:12 -0500, Walter Bright
wrote:
Lots of meat and potatoes here, and a cookie! (spelling checker for
error messages)
http://www.digitalmars.com/d/1.0/changelog.html
http://ftp.digitalmars.com/dmd.1.057.zip
http://www.digitalmars.com/d/2.0/changelog.html
http://ftp
The Html of the change logs seems a bit wrong, the latest version now is at the
top, and in the 2.0 changelog the "Bugs Fixed" are divided in two different
horizontal alignments.
Ary Borenszweig wrote:
Walter Bright wrote:
Lots of meat and potatoes here, and a cookie! (spelling checker for
error messages)
http://www.digitalmars.com/d/1.0/changelog.html
http://ftp.digitalmars.com/dmd.1.057.zip
http://www.digitalmars.com/d/2.0/changelog.html
http://ftp.digitalmars.com/
Walter Bright Wrote:
> Lots of meat and potatoes here, and a cookie! (spelling checker for
> error messages)
Thank you for the cookie too :-)
I will need some more time to try all the new things.
In the meantime I have already two small questions:
1) What does "Implemented attributes for constr
Walter Bright wrote:
Lots of meat and potatoes here, and a cookie! (spelling checker for
error messages)
http://www.digitalmars.com/d/1.0/changelog.html
http://ftp.digitalmars.com/dmd.1.057.zip
http://www.digitalmars.com/d/2.0/changelog.html
http://ftp.digitalmars.com/dmd.2.041.zip
Thanks to
On Mon, 08 Mar 2010 03:45:21 -0500, Lars T. Kyllingstad
wrote:
Simen kjaeraas wrote:
Walter Bright wrote:
Lots of meat and potatoes here, and a cookie! (spelling checker for
error messages)
http://www.digitalmars.com/d/1.0/changelog.html
http://ftp.digitalmars.com/dmd.1.057.zip
http:
On Mon, 08 Mar 2010 09:54:12 +0300, Walter Bright
wrote:
Lots of meat and potatoes here, and a cookie! (spelling checker for
error messages)
http://www.digitalmars.com/d/1.0/changelog.html
http://ftp.digitalmars.com/dmd.1.057.zip
http://www.digitalmars.com/d/2.0/changelog.html
http://ftp
> C:\Jpro\dpro\small>xfbuild xft.d
> Thread 1: compiling 1 modules
> Thread 0: compiling 0 modules
> Error: unrecognized switch '-deps=xft.moduleDeps'
> Build failed: "dmd @xfbuild.1660e00.rsp" returned 1
>
Yeah it still has its quirks. Feel free to contact the authors/file an
issue/etc.
Walter Bright wrote:
Lots of meat and potatoes here, and a cookie! (spelling checker for
error messages)
http://www.digitalmars.com/d/1.0/changelog.html
http://ftp.digitalmars.com/dmd.1.057.zip
http://www.digitalmars.com/d/2.0/changelog.html
http://ftp.digitalmars.com/dmd.2.041.zip
Thanks to
Simen kjaeraas wrote:
Walter Bright wrote:
Lots of meat and potatoes here, and a cookie! (spelling checker for
error messages)
http://www.digitalmars.com/d/1.0/changelog.html
http://ftp.digitalmars.com/dmd.1.057.zip
http://www.digitalmars.com/d/2.0/changelog.html
http://ftp.digitalmars.com
Walter Bright wrote:
Lots of meat and potatoes here, and a cookie! (spelling checker for
error messages)
http://www.digitalmars.com/d/1.0/changelog.html
http://ftp.digitalmars.com/dmd.1.057.zip
http://www.digitalmars.com/d/2.0/changelog.html
http://ftp.digitalmars.com/dmd.2.041.zip
Thanks
Walter Bright wrote:
Lots of meat and potatoes here, and a cookie! (spelling checker for
error messages)
http://www.digitalmars.com/d/1.0/changelog.html
http://ftp.digitalmars.com/dmd.1.057.zip
http://www.digitalmars.com/d/2.0/changelog.html
http://ftp.digitalmars.com/dmd.2.041.zip
Thanks to
Thanks! A pleasant surprise to see interface contracts.
61 matches
Mail list logo