On Mon, 2012-04-16 at 21:03 +0200, Somedude wrote:
[...]
Did you file a bug report ? If yes, which number ? This is an annoying
regression in my opinion.
Issue 7919
http://d.puremagic.com/issues/show_bug.cgi?id=7919
--
Russel.
On 04/16/2012 03:57 AM, Zardoz wrote:
So, if I need to share a array of 0x1 elements between 3 or more
threads, how should do it ?
1) The following program starts four threads to fill different parts of
a shared array:
import std.stdio;
import std.concurrency;
import core.thread;
void
DMC = Digital Mars Compiler? Does Mingw/GDC uses that? I think that
both, g++ and GDC compiled binaries, use the mingw runtime, but I'm not
sure also.
you right, only dmd uses dmc environment, gdc uses mingw's.
And I don't think it is I/O bound. It is only around 10MB/s, whereas my HD
Le 17/04/2012 02:01, Ali Çehreli a écrit :
On 04/16/2012 04:56 PM, darkstalker wrote:
i have this example program:
---
void main()
{
int[3] a;
foreach (p; a)
p = 42;
writeln(a);
}
---
after running it, i expect to get [42, 42, 42] but instead i get [0, 0,
0] (i know that you can do
Now i have something like this. It works and manipulates lvalues
so that i can pass my objects by ref to except null.
But is this smart?
class Bar {
public:
int x;
static ref Bar opCall(int x) {
static Bar b;
b = new
Le 17/04/2012 08:40, Russel Winder a écrit :
On Mon, 2012-04-16 at 21:03 +0200, Somedude wrote:
[...]
Issue 7919
http://d.puremagic.com/issues/show_bug.cgi?id=7919
Thanks.
On Tuesday, 17 April 2012 at 08:02:02 UTC, Namespace wrote:
Now i have something like this. It works and manipulates
lvalues so that i can pass my objects by ref to except null.
But is this smart?
class Bar {
public:
int x;
static ref Bar opCall(int x) {
On 17.04.2012 12:28, Erèbe wrote:
Hi,
I'm working on some metaprogramming code which implement a Factory and
generate an enum from a list of string.
So here my questions :
1) The documentation say mixin templates could take as
TemplateParameterList
a TemplateParameter , TemplateParameterList
Le 17/04/2012 12:19, Mike Parker a écrit :
On 4/17/2012 4:42 PM, Somedude wrote:
Ali
Hi Ali,
Sorry for hijacking this thread, but since you're around, I hope you'll
see this message. As a D beginner, I'm browsing through your book.
I wanted to tell you that there is something essential
On Tuesday, 17 April 2012 at 10:29:56 UTC, Kenji Hara wrote:
On Tuesday, 17 April 2012 at 08:28:45 UTC, Erèbe wrote:
Hi,
I'm working on some metaprogramming code which implement a
Factory and generate an enum from a list of string.
So here my questions :
1) The documentation say mixin
In this case, I had to type:
rdmd -unittest --main test.d
Without the --main, I would get linker errors, and couldn't find the
reason for these errors. Happily, someone here explained me that the
effect of the --main flag was to insert a main() function just for this
case.
That's not
On Tuesday, 17 April 2012 at 12:04:44 UTC, Erèbe wrote:
[snip]
There is something I still don't understand :
mixin template Foo( T... )
{
//Code here
}
mixin Foo!( Hello, Word ); Good
T is TemplateTypeParameter, and matches any kind of template
arguments - types, values, and symbols.
Le 17/04/2012 09:30, Somedude a écrit :
Anyway, I think I'll add this simple piece of info somewhere in the
wiki. I've already cleaned it up a little.
Ok, here it is: http://prowiki.org/wiki4d/wiki.cgi?HowTo/UnitTests
Thanks! It's very useful.
Ali Çehreli wrote:
synchronized (job) {
*job.slice ~= appendValue;
}
So shared, at least share data across threads. And using synchronized( )
I could do lock-based access to shared data.
On 04/17/2012 06:05 AM, Luis wrote:
Thanks! It's very useful.
Ali Çehreli wrote:
synchronized (job) {
*job.slice ~= appendValue;
}
So shared, at least share data across threads. And using synchronized( )
I could do lock-based access to shared data.
Yes. I've used the same Job object there
On 04/17/2012 12:42 AM, Somedude wrote:
Sorry for hijacking this thread, but since you're around, I hope you'll
see this message. As a D beginner, I'm browsing through your book.
I wanted to tell you that there is something essential missing in it:
how to compile. It's actually quite hard to
On Tuesday, 17 April 2012 at 01:31:43 UTC, Kenji Hara wrote:
On Monday, 16 April 2012 at 18:48:52 UTC, Xan wrote:
On Sunday, 15 April 2012 at 19:30:27 UTC, Ali Çehreli wrote:
On 04/15/2012 11:39 AM, Xan wrote:
On Sunday, 15 April 2012 at 11:23:37 UTC, John Chapman
wrote:
On Sunday, 15
Consider this simple function:
private string findParameterList(string typestr)
{
auto strippedHead = typestr.find(()[1 .. $];
auto strippedTail = retro(strippedHead).find());
strippedTail.popFront(); // slice off closing
On 4/17/12, Somedude lovelyd...@mailmetrash.com wrote:
Do you have any idea where this is explained
rdmd --help
Off-topic, could can I define toString having this structure:
Name of the function (versió version number): Domain -
Range, code of the function
?
(For example, in https://gist.github.com/2394274 I want that
Doblar displays as:
Doblar (versió 1): int - int, { return 2 * a; }
Thanks a
Jakob Ovrum:
return array(strippedTail);
}
The type of the return expression is dstring, not string.
What is the most elegant way or correct way to solve this
friction?
(Note: the function is used in CTFE)
Try text instead of array.
Bye,
bearophile
On Tuesday, 17 April 2012 at 14:57:18 UTC, Xan wrote:
On Tuesday, 17 April 2012 at 01:31:43 UTC, Kenji Hara wrote:
On Monday, 16 April 2012 at 18:48:52 UTC, Xan wrote:
On Sunday, 15 April 2012 at 19:30:27 UTC, Ali Çehreli wrote:
On 04/15/2012 11:39 AM, Xan wrote:
On Sunday, 15 April 2012 at
On Tuesday, 17 April 2012 at 15:21:30 UTC, Dejan Lekic wrote:
On Tuesday, 17 April 2012 at 14:57:18 UTC, Xan wrote:
On Tuesday, 17 April 2012 at 01:31:43 UTC, Kenji Hara wrote:
On Monday, 16 April 2012 at 18:48:52 UTC, Xan wrote:
On Sunday, 15 April 2012 at 19:30:27 UTC, Ali Çehreli wrote:
On 04/17/2012 08:17 AM, Xan wrote:
Off-topic, could can I define toString having this structure:
Name of the function (versió version number): Domain - Range,
code of the function
?
(For example, in https://gist.github.com/2394274 I want that Doblar
displays as:
Doblar (versió 1): int - int,
On Saturday, 14 April 2012 at 10:48:16 UTC, Luis Panadero
Guardeño wrote:
What is the status of shared types ?
I try it with gdmd v4.6.3
And I not get any warring/error when I do anything over a
shared variable
without using atomicOp. It's normal ?
shared ushort ram[ram_size];
On Tuesday, 17 April 2012 at 09:39:10 UTC, Namespace wrote:
On Tuesday, 17 April 2012 at 08:02:02 UTC, Namespace wrote:
Now i have something like this. It works and manipulates
lvalues so that i can pass my objects by ref to except null.
But is this smart?
class Bar {
public:
int x;
On Tuesday, 17 April 2012 at 15:30:36 UTC, Ali Çehreli wrote:
On 04/17/2012 08:17 AM, Xan wrote:
Off-topic, could can I define toString having this structure:
Name of the function (versió version number): Domain -
Range,
code of the function
?
(For example, in
On 04/17/2012 08:12 AM, Jakob Ovrum wrote:
Consider this simple function:
private string findParameterList(string typestr)
{
auto strippedHead = typestr.find(()[1 .. $];
auto strippedTail = retro(strippedHead).find());
strippedTail.popFront(); // slice off closing parenthesis
return
On 04/17/2012 02:39 AM, Namespace wrote:
Bar b = new Bar(42);
new Foo(b); // works
new Foo(null); // compiler error
That fails because null is a compile time value and you have a special
template code for that that fails the compilation.
new Foo(Bar(23)); // works
new Foo(Bar(25)); //
On 04/17/2012 08:49 AM, Ali Çehreli wrote:
That fails because null is a compile time value and you have a special
template code for that that fails the compilation.
Scratch the 'template' part. You don't have templates there but what I
said is still valid. Basically, you have some code that
Ali Çehreli:
The reason is, a sequence of UTF-8 code units are not a valid
UTF-8 when reversed (or retro'ed :p).
But reversed(char[]) now works :-)
Bye,
bearophile
On 04/17/2012 08:42 AM, Xan wrote:
How to get the code of a function or delegate
|___string toString() {
|___|___return format(%s (versió %s): Domini - Recorregut, %s(x) =
%s, nom, versio, nom, funcio);
|___}
does not produce the desired result and funcio without ampersand
produces me
On 04/17/2012 08:58 AM, bearophile wrote:
Ali Çehreli:
The reason is, a sequence of UTF-8 code units are not a valid UTF-8
when reversed (or retro'ed :p).
But reversed(char[]) now works :-)
That's pretty cool. :) (You meant reverse()).
Interesting, because there could be no other way
On 04/17/2012 06:09 PM, Ali Çehreli wrote:
On 04/17/2012 08:58 AM, bearophile wrote:
Ali Çehreli:
The reason is, a sequence of UTF-8 code units are not a valid UTF-8
when reversed (or retro'ed :p).
But reversed(char[]) now works :-)
That's pretty cool. :) (You meant reverse()).
On 04/17/2012 09:12 AM, Timon Gehr wrote:
On 04/17/2012 06:09 PM, Ali Çehreli wrote:
The algorithm must be building a local string.
It does not have to build a local string, see
http://dlang.org/phobos/std_utf.html#strideBack
I never said otherwise. :p
I was too lazy to locate where
For that, you have static if contitions, and indeed you can
make it a compile-time error.
Can you show me this as code? And are there any plans to realize
non-null references or strategies to avoid such things? Otherwise
there would really be something important missing in D.
Yes, you must because whetheer obj is null is only known at
runtime.
Yes, but if i forget the assert i get an Access Violation error
with no more informations. Problem is nobody knows _why_ he gets
this error, because the error message gives no information.
So it must be a better solution
On Tuesday, 17 April 2012 at 15:59:25 UTC, Ali Çehreli wrote:
On 04/17/2012 08:42 AM, Xan wrote:
How to get the code of a function or delegate
|___string toString() {
|___|___return format(%s (versió %s): Domini - Recorregut,
%s(x) =
%s, nom, versio, nom, funcio);
|___}
does not
On 04/17/2012 10:37 AM, Namespace wrote:
Yes, you must because whetheer obj is null is only known at runtime.
Yes, but if i forget the assert i get an Access Violation error with no
more informations. Problem is nobody knows _why_ he gets this error,
because the error message gives no
On Tuesday, 17 April 2012 at 18:00:55 UTC, Xan wrote:
On Tuesday, 17 April 2012 at 15:59:25 UTC, Ali Çehreli wrote:
On 04/17/2012 08:42 AM, Xan wrote:
How to get the code of a function or delegate
|___string toString() {
|___|___return format(%s (versió %s): Domini - Recorregut,
%s(x) =
On Tuesday, April 17, 2012 19:22:30 André Stein wrote:
Hi,
I'm trying to pass the range returned by iota to a function accepting
the parameter as const. I got compilation errors when trying to use the
index operator and after some investigation it turned out that opSlice
of iota.Result
Hello all,
As per earlier discussion I'm trying to hack on Phobos to update the random
sampling code.
To do this I've just copied random.d into a new file, randomsample.d, which I'm
modifying and messing around with; I'm trying to build against a local copy of
the GitHub Phobos sources.
On Tuesday, 17 April 2012 at 18:00:55 UTC, Xan wrote:
On Tuesday, 17 April 2012 at 15:59:25 UTC, Ali Çehreli wrote:
On 04/17/2012 08:42 AM, Xan wrote:
How to get the code of a function or delegate
|___string toString() {
|___|___return format(%s (versió %s): Domini - Recorregut,
%s(x) =
Best of all solutions would be that a
special keyword, for example scope, ensure that lvalues would
except but
_no_ null-references.
Yes, the keyword would be a little shorter than the assert() or
enforce() above but D already has very many keywords. :)
Yes, but scope is an unused storage
On 04/17/2012 08:10 PM, Namespace wrote:
Best of all solutions would be that a
special keyword, for example scope, ensure that lvalues would
except but
_no_ null-references.
Yes, the keyword would be a little shorter than the assert() or
enforce() above but D already has very many keywords.
On Tuesday, April 17, 2012 20:10:51 Joseph Rushton Wakeling wrote:
Hello all,
As per earlier discussion I'm trying to hack on Phobos to update the random
sampling code.
To do this I've just copied random.d into a new file, randomsample.d, which
I'm modifying and messing around with; I'm
On 04/17/2012 11:13 AM, Xan wrote:
The idea is behind this https://gist.github.com/2407923
But I receive:
$ gdmd-4.6 algorisme_code.d
algorisme_code.d:22: Error: variable codi cannot be read at compile time
algorisme_code.d:22: Error: argument to mixin must be a string, not
(codi)
mixin
On 17.04.2012 22:10, Joseph Rushton Wakeling wrote:
Hello all,
As per earlier discussion I'm trying to hack on Phobos to update the
random sampling code.
To do this I've just copied random.d into a new file, randomsample.d,
which I'm modifying and messing around with; I'm trying to build
Define 'ensure'.
Guarantee, that the given object parameter isn't a null reference.
On Tuesday, 17 April 2012 at 18:25:21 UTC, Ali Çehreli wrote:
On 04/17/2012 11:13 AM, Xan wrote:
The idea is behind this https://gist.github.com/2407923
But I receive:
$ gdmd-4.6 algorisme_code.d
algorisme_code.d:22: Error: variable codi cannot be read at
compile time
algorisme_code.d:22:
On Tue, Apr 17, 2012 at 10:29:24PM +0400, Dmitry Olshansky wrote:
On 17.04.2012 22:10, Joseph Rushton Wakeling wrote:
Hello all,
As per earlier discussion I'm trying to hack on Phobos to update the
random sampling code.
To do this I've just copied random.d into a new file, randomsample.d,
On 04/17/2012 08:40 PM, Namespace wrote:
Define 'ensure'.
Guarantee, that the given object parameter isn't a null reference.
But C++ does not do that either.
Are you asking for a full-blown non-null type system?
But C++ does not do that either.
Are you asking for a full-blown non-null type system?
Yes, but of course only with a special Keyword/Storage class.
On 17/04/12 20:29, Dmitry Olshansky wrote:
First things first - development of phobos is done with dmd. Just because gdc is
(logically so) somewhat behind dmd and new compiler features are still coming
with every release.
Fair enough. I've followed the instructions here:
On 17/04/12 20:47, H. S. Teoh wrote:
The convention is to create a branch for making changes, this way it's
very easy to generate pull requests on github if you ever wanted to
contribute your code to the official codebase. Branches are super-cheap
in git anyway, and you can edit source files to
On 17.04.2012 23:27, Joseph Rushton Wakeling wrote:
On 17/04/12 20:29, Dmitry Olshansky wrote:
First things first - development of phobos is done with dmd. Just
because gdc is
(logically so) somewhat behind dmd and new compiler features are still
coming
with every release.
Fair enough. I've
On 04/17/2012 09:16 PM, Namespace wrote:
But C++ does not do that either.
Are you asking for a full-blown non-null type system?
Yes, but of course only with a special Keyword/Storage class.
If it is not the default, how would you enforce it at the caller side?
Ali:
The algorithm is smart.
The basic idea for that algorithm was mine, and Andrei was very gentle to
implement it, defining it a Very fun exercise :-)
http://d.puremagic.com/issues/show_bug.cgi?id=7086
The algorithm
above is not exception-safe because stride() may throw. But this way off
On 04/17/2012 12:57 PM, bearophile wrote:
The algorithm
above is not exception-safe because stride() may throw. But this way off
topic on this thread. :)
You can't expect Phobos to be perfect, it needs to be improved
iteratively. If you think that's not exception safe and and there are
On Tuesday, 17 April 2012 at 19:56:11 UTC, Timon Gehr wrote:
On 04/17/2012 09:16 PM, Namespace wrote:
But C++ does not do that either.
Are you asking for a full-blown non-null type system?
Yes, but of course only with a special Keyword/Storage class.
If it is not the default, how would you
Just for fun I decided to complete some codejam challenges in D. At some
point I wanted to add structs to an array but I got a compiler error. What
am I doing wrong?
code:
struct test{
int x;
int y;
}
void main(){
test[] why;
why~={3,5};
}
error:
wait.d(7): found '}' when expecting ';' following
Ali Çehreli:
Agreed.
But I am not that sure about this particular function anymore
because for the function to be not 'strongly exception safe',
the input string must be invalid UTF-8 to begin with.
I am not sure how bad it is to not preserve the actual
invalidness of the string in that
On Tuesday, 17 April 2012 at 12:46:28 UTC, Kenji Hara wrote:
On Tuesday, 17 April 2012 at 12:04:44 UTC, Erèbe wrote:
[snip]
There is something I still don't understand :
mixin template Foo( T... )
{
//Code here
}
mixin Foo!( Hello, Word ); Good
T is TemplateTypeParameter, and matches
On Tue, Apr 17, 2012 at 10:28:31PM +0200, maarten van damme wrote:
Just for fun I decided to complete some codejam challenges in D. At
some point I wanted to add structs to an array but I got a compiler
error. What am I doing wrong?
code:
struct test{
int x;
int y;
}
void main(){
On Tue, 17 Apr 2012 22:28:31 +0200, maarten van damme
maartenvd1...@gmail.com wrote:
Just for fun I decided to complete some codejam challenges in D. At some
point I wanted to add structs to an array but I got a compiler error.
What
am I doing wrong?
code:
struct test{
int x;
int y;
}
simendsjo:
Sounds like a bug. C style initializers work in other cases:
D language is so much irregular, so many special cases that don't
work :-)
Bye,
bearophile
Another idea: instead scope, in can get a new functionality.
Instead as a synonym for const it could mean not null for
objects.
On Tuesday, 17 April 2012 at 21:00:55 UTC, simendsjo wrote:
On Tue, 17 Apr 2012 22:28:31 +0200, maarten van damme
maartenvd1...@gmail.com wrote:
Just for fun I decided to complete some codejam challenges in
D. At some
point I wanted to add structs to an array but I got a compiler
error. What
Can anyone explain to me why, when I compile run this code, the two samples
seeded with the unpredictableSeed always come out with the same starting value?
//
import std.random, std.range, std.stdio;
void main()
{
auto s =
On Wednesday, 18 April 2012 at 03:47:31 UTC, Joseph Rushton
Wakeling wrote:
Can anyone explain to me why, when I compile run this code,
the two samples seeded with the unpredictableSeed always come
out with the same starting value?
On 04/17/2012 02:00 PM, simendsjo wrote:
Sounds like a bug. C style initializers work in other cases:
I try not to use them. I think they have this 'feature' of leaving
unspecified members uninitialized:
struct S
{
int i;
double d;
}
void main()
{
S s = { 42 }; //
On Wednesday, 18 April 2012 at 03:47:31 UTC, Joseph Rushton
Wakeling wrote:
Can anyone explain to me why, when I compile run this code,
the two samples seeded with the unpredictableSeed always come
out with the same starting value?
On 18/04/12 06:43, jerro wrote:
According to the comment the call to prime() is necessary
so that the result doesn't always start with the same element.
But prime() uses the gen member which is only assigned after the
constructor completes. So at the time when prime() is called the
gen member is
On Wednesday, 18 April 2012 at 05:05:20 UTC, Joseph Rushton
Wakeling wrote:
On 18/04/12 06:43, jerro wrote:
According to the comment the call to prime() is necessary
so that the result doesn't always start with the same element.
But prime() uses the gen member which is only assigned after
the
On Tuesday, 17 April 2012 at 15:36:39 UTC, Ali Çehreli wrote:
The reason is, a sequence of UTF-8 code units are not a valid
UTF-8 when reversed (or retro'ed :p). But a dchar array can be
reversed.
Ali
It is absolutely possible to walk a UTF-8 string backwards.
The problem here is that
On Tuesday, 17 April 2012 at 15:18:49 UTC, bearophile wrote:
Jakob Ovrum:
return array(strippedTail);
}
The type of the return expression is dstring, not string.
What is the most elegant way or correct way to solve this
friction?
(Note: the function is used in
76 matches
Mail list logo