Thanks. I's much more clear now.
On 03/14/2013 04:58 PM, Jesse Phillips wrote:
On Thursday, 14 March 2013 at 21:40:34 UTC, Ali Çehreli wrote:
I had toyed with the idea of making a ForwardRange from an InputRange
by caching the elements. Without any guarantees, :) here is the code:
http://forum.dlang.org/thread/ifg5ei$2qc7$1...
On Friday, March 15, 2013 03:41:14 anonymous wrote:
> On Friday, 15 March 2013 at 02:31:32 UTC, anonymous wrote:
> > Then it struck me:
> > The compiler doesn't know that f's return value is unknown to
> > the rest of the world, because f isn't marked pure.
> > And, indeed, make f pure and it just
anonymous:
The compiler doesn't know that f's return value is unknown to
the rest of the world, because f isn't marked pure.
And, indeed, make f pure and it just works: int[] f() pure
{return [1, 2, 3];} immutable v = f();
Awesome!
"purity" seems a simple idea, but if you try to implement i
On Friday, 15 March 2013 at 02:31:32 UTC, anonymous wrote:
Then it struck me:
The compiler doesn't know that f's return value is unknown to
the rest of the world, because f isn't marked pure.
And, indeed, make f pure and it just works: int[] f() pure
{return [1, 2, 3];} immutable v = f();
Awe
Just a little newbie aha moment I'd like to share.
I was about to post this:
int[] f() {return [1, 2, 3];}
As far as I understand, f returns a fresh array on each call,
and therefore, it should be safe to store the result in an
immutable variable.
Unfortunately, this fails: immutable v = f
Ok, I did a bit more reading of TDPL and decided to go with the
following pattern:
synchronized class A{
private string[] _values;
void setValue(size_t i, string val) {_values[i] = val;}
string getValue(size_t i) const {return _values[i];}
}
Works fine, my problem solved :) Ag
Marco Leise:
This is "just" a syntax ambiguity. a[] takes the complete
slice of the array 'a'. And a dynamic array in D is a slice.
So if you use a or a[] in an expression doesn't make much of a
difference.
Yet in D the only accepted syntax to perform a vector op sum is
to use add square brac
Am Thu, 14 Mar 2013 22:15:11 +0100
schrieb "bearophile" :
> Andrea Fontana:
>
> > But does sort!"a
> See the difference in syntax:
>
> a < b
> a[] < b[]
>
> Bye,
> bearophile
This is "just" a syntax ambiguity. a[] takes the complete
slice of the array 'a'. And a dynamic array in D is a slice.
Hi All,
I'm getting myself confused with thread-safety and locking. I
have a class something like the following small example:
class A{
private string[] _values;
void setValue(size_t i, string val) {_values[i] = val;}
string getValue(size_t i) conts {return _values[i];}
const(
On Thursday, 14 March 2013 at 21:40:34 UTC, Ali Çehreli wrote:
I had toyed with the idea of making a ForwardRange from an
InputRange by caching the elements. Without any guarantees, :)
here is the code:
http://forum.dlang.org/thread/ifg5ei$2qc7$1...@digitalmars.com
Ali
I attempted to crea
15-Mar-2013 01:17, Artur Skawina пишет:
On 03/14/13 18:24, Dmitry Olshansky wrote:
14-Mar-2013 21:20, Namespace пишет:
Yes, and it's really fun. :)
By the way, the code can be found here:
https://github.com/Dgame/Puzzle/blob/master/DLexer.d
Maybe some of you have an idea how I could improve any
Andrea Fontana:
But does sort!"a
See the difference in syntax:
a < b
a[] < b[]
Bye,
bearophile
On 03/14/13 18:24, Dmitry Olshansky wrote:
> 14-Mar-2013 21:20, Namespace пишет:
>> Yes, and it's really fun. :)
>> By the way, the code can be found here:
>> https://github.com/Dgame/Puzzle/blob/master/DLexer.d
>> Maybe some of you have an idea how I could improve anything.
>> Last trace.log is al
On Thursday, 14 March 2013 at 20:59:38 UTC, Zach the Mystic wrote:
On Wednesday, 13 March 2013 at 22:14:26 UTC, Timon Gehr wrote:
On 03/12/2013 10:47 PM, Zach the Mystic wrote:
void func(string[2] a) {}
void func2(T...)(T args) {
static assert(is(typeof(args[0]) == string[2]));
}
void func3
On Wednesday, 13 March 2013 at 22:14:26 UTC, Timon Gehr wrote:
On 03/12/2013 10:47 PM, Zach the Mystic wrote:
void func(string[2] a) {}
void func2(T...)(T args) {
static assert(is(typeof(args[0]) == string[2]));
}
void func3(T...)(T args) {
static assert(args[0].length == 2);
}
func([""
On Thursday, 14 March 2013 at 18:41:25 UTC, bearophile wrote:
Andrea Fontana:
I always think X < Y return a single bool,
Having a practice with NumPy and the like, I think X < Y as
returning as many bools as the length of X and Y:
from numpy import *
a = array([1, 5, 1])
b = array([1, 1,
Andrea Fontana:
I always think X < Y return a single bool,
Having a practice with NumPy and the like, I think X < Y as
returning as many bools as the length of X and Y:
from numpy import *
a = array([1, 5, 1])
b = array([1, 1, 5])
a < b
array([False, False, True], dtype=bool)
Programme
On Thursday, 14 March 2013 at 17:56:07 UTC, Ali Çehreli wrote:
On 03/14/2013 10:45 AM, Andrea Fontana wrote:
> You see? Your code do this:
>
> a[] = (b[] < c[]);
I thought the same thing at first but note the brackets after b
and c. Those should make this an array-wise operation.
For all ele
On 03/14/2013 10:45 AM, Andrea Fontana wrote:
> You see? Your code do this:
>
> a[] = (b[] < c[]);
I thought the same thing at first but note the brackets after b and c.
Those should make this an array-wise operation.
For all elements of a to be the same value, one would not write the
bracke
On Thursday, 14 March 2013 at 13:58:45 UTC, n00b wrote:
I tried to use a boolean operator for an array operation :
a[] = b[] < c[];
It compiles but seems to only fill a[] with the result of b[0]
< c[0].
Is there any "rational" reason to that?
Yes i think there is a rational reason. Check th
14-Mar-2013 21:20, Namespace пишет:
Yes, and it's really fun. :)
By the way, the code can be found here:
https://github.com/Dgame/Puzzle/blob/master/DLexer.d
Maybe some of you have an idea how I could improve anything.
Last trace.log is also there:
https://github.com/Dgame/Puzzle/blob/master/trac
Yes, and it's really fun. :)
By the way, the code can be found here:
https://github.com/Dgame/Puzzle/blob/master/DLexer.d
Maybe some of you have an idea how I could improve anything.
Last trace.log is also there:
https://github.com/Dgame/Puzzle/blob/master/trace.log
My goal is about 20 msecs.
14-Mar-2013 21:20, Namespace пишет:
Yes, and it's really fun. :)
By the way, the code can be found here:
https://github.com/Dgame/Puzzle/blob/master/DLexer.d
Maybe some of you have an idea how I could improve anything.
Last trace.log is also there:
https://github.com/Dgame/Puzzle/blob/master/trac
On Thursday, 14 March 2013 at 13:58:45 UTC, n00b wrote:
I tried to use a boolean operator for an array operation :
a[] = b[] < c[];
It compiles but seems to only fill a[] with the result of b[0]
< c[0].
Is there any "rational" reason to that?
And is there any way to use boolean operator for a
14-Mar-2013 01:19, Namespace пишет:
Array has an horrible code...
I decided to start from scratch.
So I took a close look at the lexer of dmd and took over the basic
functionality.
Result for std.datetime (without profiling so far):
It's getting better!
Total time (
On Thursday, 14 March 2013 at 16:26:21 UTC, bearophile wrote:
simendsjo:
Would be nice to easily see that the templates are being
tested more properly though.
Then add an enhancement request in bugzilla. Maybe there is a
way to implement it.
I remember someone asking for a compiler switch
simendsjo:
Would be nice to easily see that the templates are being tested
more properly though.
Then add an enhancement request in bugzilla. Maybe there is a way
to implement it.
I remember someone asking for a compiler switch that lists all
the implemented templates...
Bye,
bearophile
On Thursday, 14 March 2013 at 16:09:01 UTC, bearophile wrote:
simendsjo:
Code coverage doesn't work with templates. Is this by design?
A code coverage tells how many time a line of code is run at
run-time. But your template contains no code that is run at
run-time. So you are looking for a
On Tue, 12 Mar 2013 17:47:00 -0400, Zach the Mystic
wrote:
void func(string[2] a) {}
void func2(T...)(T args) {
static assert(is(typeof(args[0]) == string[2]));
}
void func3(T...)(T args) {
static assert(args[0].length == 2);
}
func(["",""]); // Okay
func2(["",""]); // Error: (is(
simendsjo:
Code coverage doesn't work with templates. Is this by design?
A code coverage tells how many time a line of code is run at
run-time. But your template contains no code that is run at
run-time. So you are looking for a different kind of counter.
Bye,
bearophile
This has already been reported
http://d.puremagic.com/issues/show_bug.cgi?id=5636
Code coverage doesn't work with templates. Is this by design?
t.d:
module t;
template t(T) {
static if(is(T == int))
alias int t;
else static if(is(T == short))
alias short t;
}
unittest {
t!int a = 10;
assert(a == 10);
}
n00b:
Is there any "rational" reason to that?
It's not implemented (and it's a bug that it returns something
different). Take a look in Bugzilla if it's already there.
And is there any way to use boolean operator for array
operations?
I think the only supported boolean vec operation is
Thanks Adam! You saved my day ;)
On Thursday, 14 March 2013 at 10:39:11 UTC, Jack Applegame wrote:
What does mean attribute shared exactly for non global
variables? Is it safe to cast to/from shared?
For example, let us assume all data are synchronized properly.
Is following code safe?
import core.atomic;
class A {
int v
On Thursday, 14 March 2013 at 00:52:41 UTC, Timon Gehr wrote:
On 03/14/2013 01:48 AM, Jeremy DeHaan wrote:
Hey guys!
I am working on a binding for D, and am almost finished! I
started to
think of some things I might like to work on to improve the
binding
after I get everything working, and on
On Thursday, 14 March 2013 at 13:58:45 UTC, n00b wrote:
I tried to use a boolean operator for an array operation :
a[] = b[] < c[];
It compiles but seems to only fill a[] with the result of b[0]
< c[0].
Is there any "rational" reason to that?
And is there any way to use boolean operator for a
gotta init the d runtime first
extern (C)
void startd() {
Runtime.initialize();
}
adn then in C, before using any other D, call startd();
On Thursday, 14 March 2013 at 14:29:59 UTC, Andrea Fontana wrote:
On Thursday, 14 March 2013 at 13:58:56 UTC, monarch_dodra wrote:
On Thursday, 14 March 2013 at 13:20:51 UTC, Andrea Fontana
wrote:
On Thursday, 14 March 2013 at 12:29:26 UTC, Andrei
Alexandrescu wrote:
On 3/14/13 6:45 AM, Andrea
Hi guys!
I'm trying to write D module for existing C/C++ project with no
success :(
What I'm doing:
[code]
dmd -g -w -c test.d
gcc -g -Wall -Werror test.c test.o -ldruntime -lphobos2 -lrt
-pthread -o test-app
[/code]
Executable is linked successfully, but fails with "Segmentation
fault".
On Thursday, 14 March 2013 at 13:58:56 UTC, monarch_dodra wrote:
On Thursday, 14 March 2013 at 13:20:51 UTC, Andrea Fontana
wrote:
On Thursday, 14 March 2013 at 12:29:26 UTC, Andrei
Alexandrescu wrote:
On 3/14/13 6:45 AM, Andrea Fontana wrote:
On Thursday, 14 March 2013 at 10:08:53 UTC, Andrea
On Thursday, 14 March 2013 at 13:20:51 UTC, Andrea Fontana wrote:
On Thursday, 14 March 2013 at 12:29:26 UTC, Andrei Alexandrescu
wrote:
On 3/14/13 6:45 AM, Andrea Fontana wrote:
On Thursday, 14 March 2013 at 10:08:53 UTC, Andrea Fontana
wrote:
I'm trying to implement a db cursor as simple Inpu
I tried to use a boolean operator for an array operation :
a[] = b[] < c[];
It compiles but seems to only fill a[] with the result of b[0] <
c[0].
Is there any "rational" reason to that?
And is there any way to use boolean operator for array operations?
On Thursday, 14 March 2013 at 12:29:26 UTC, Andrei Alexandrescu
wrote:
On 3/14/13 6:45 AM, Andrea Fontana wrote:
On Thursday, 14 March 2013 at 10:08:53 UTC, Andrea Fontana
wrote:
I'm trying to implement a db cursor as simple InputRange. I
can't
implement as forward range because using c-api I c
On 3/14/13 6:45 AM, Andrea Fontana wrote:
On Thursday, 14 March 2013 at 10:08:53 UTC, Andrea Fontana wrote:
I'm trying to implement a db cursor as simple InputRange. I can't
implement as forward range because using c-api I can't clone/save cursor.
I wrote popFront() front() and empty() method a
On 03/14/13 01:52, Timon Gehr wrote:
> On 03/14/2013 01:48 AM, Jeremy DeHaan wrote:
>>
>> I am working on a binding for D, and am almost finished! I started to
>> think of some things I might like to work on to improve the binding
>> after I get everything working, and one of the things I thought o
On Thursday, 14 March 2013 at 10:08:53 UTC, Andrea Fontana wrote:
I'm trying to implement a db cursor as simple InputRange. I
can't implement as forward range because using c-api I can't
clone/save cursor.
I wrote popFront() front() and empty() method and my range
works fine.
Using on a for
On Thursday, March 14, 2013 11:08:52 Andrea Fontana wrote:
> I'm trying to implement a db cursor as simple InputRange. I can't
> implement as forward range because using c-api I can't clone/save
> cursor.
>
> I wrote popFront() front() and empty() method and my range works
> fine.
>
> Using on a
What does mean attribute shared exactly for non global variables?
Is it safe to cast to/from shared?
For example, let us assume all data are synchronized properly. Is
following code safe?
import core.atomic;
class A {
int value;
}
struct B {
A node;
}
void main() {
shared B data;
A
I'm trying to implement a db cursor as simple InputRange. I can't
implement as forward range because using c-api I can't clone/save
cursor.
I wrote popFront() front() and empty() method and my range works
fine.
Using on a foreach() it browses all elements inside range until
range is exausth
On Thursday, 14 March 2013 at 00:48:53 UTC, Jeremy DeHaan wrote:
Hey guys!
I am working on a binding for D, and am almost finished!
Are you going to publish this binding? Which library?
On Wednesday, 13 March 2013 at 15:47:29 UTC, Jonathan M Davis
wrote:
On Wednesday, March 13, 2013 11:59:52 Andrea Fontana wrote:
On Wednesday, 13 March 2013 at 10:11:51 UTC, simendsjo wrote:
> You can redefine the DDOC macro to use a stylesheet. Add your
> base ddoc file on the command line with
53 matches
Mail list logo