On 2012-03-07 01:47, Jonathan M Davis wrote:
On Tuesday, March 06, 2012 11:31:40 Jacob Carlborg wrote:
On 2012-03-06 08:56, Jonathan M Davis wrote:
On Tuesday, March 06, 2012 08:29:53 Jacob Carlborg wrote:
On 2012-03-06 02:21, Jonathan M Davis wrote:
On Tuesday, March 06, 2012 01:53:02 Zach t
On 2012-03-07 00:19, H. S. Teoh wrote:
On Tue, Mar 06, 2012 at 11:40:19PM +0100, Artur Skawina wrote:
On 03/06/12 20:37, H. S. Teoh wrote:
On Tue, Mar 06, 2012 at 01:51:51AM +0100, Artur Skawina wrote:
[...]
class A {
string prop1;
int prop2;
void serialize(this THIS)() {
_
On 2012-03-06 19:17, H. S. Teoh wrote:
On Tue, Mar 06, 2012 at 08:17:07AM +0100, Jacob Carlborg wrote:
On 2012-03-05 21:16, H. S. Teoh wrote:
I know D doesn't really have RTTI yet, but I'm experimenting with
"faking" it by doing something like:
class A {
string prop1;
> On 03/06/2012 10:05 PM, ixid wrote:
> > Ah, thank you, so it's wrapping. That seems like a bad idea, what is
> > the benefit to size being unsigned rather than signed?
Because it doesn't make sense to have something with a negative size?
> > This case would seem like one where allowing negativ
On 03/06/2012 10:05 PM, ixid wrote:
> Ah, thank you, so it's wrapping. That seems like a bad idea, what is the
> benefit to size being unsigned rather than signed? This case would seem
> like one where allowing negatives is clearly better and more intuitive.
There are probably hundreds of discuss
Ah, thank you, so it's wrapping. That seems like a bad idea, what
is the benefit to size being unsigned rather than signed? This
case would seem like one where allowing negatives is clearly
better and more intuitive.
On Wed, Mar 07, 2012 at 06:11:18AM +0100, ixid wrote:
> I'm writing my first basic algorithms, this one is merge sort. This
> version throws an exception when array.length - setSize is negative
> (which should be fine, the rest of my function would deal with it):
[...]
array.length is of type size
On 03/06/2012 09:11 PM, ixid wrote:
> I'm writing my first basic algorithms, this one is merge sort. This
> version throws an exception when array.length - setSize is negative
> (which should be fine, the rest of my function would deal with it):
>
> template mergeSort(T)
> {
> void mergeSort(ref T
I'm writing my first basic algorithms, this one is merge sort.
This version throws an exception when array.length - setSize is
negative (which should be fine, the rest of my function would
deal with it):
template mergeSort(T)
{
void mergeSort(ref T[] array, const T setSize = 100)
On Tuesday, March 06, 2012 22:24:55 Caligo wrote:
> module A;
>
> private struct A { }
> private A a;
> private mixin template magic() { }
> private void foo() { }
>
> //-
>
> module B;
>
> import A;
>
> void main() {
> A b; // #1 works
Doesn't construct anything. It ju
module A;
private struct A { }
private A a;
private mixin template magic() { }
private void foo() { }
//-
module B;
import A;
void main() {
A b; // #1 works
b = a; // #2 ERROR
foo(); // #3 ERROR
}
struct B{
mixin magic; // #4 works
}
What's the point of declar
On 7 March 2012 14:47, Tyler Jameson Little wrote:
>
>> You shouldn't have to do anything with them, just write bindings for
>> the api, with all the correct types.
>>
>> --
>> James Miller
>
>
> Thanks! I guess I got a little over-zealous in porting stuff over. I just
> need to create extern (C)
You shouldn't have to do anything with them, just write
bindings for
the api, with all the correct types.
--
James Miller
Thanks! I guess I got a little over-zealous in porting stuff
over. I just need to create extern (C) bindings for the functions
that will be used, right?
On 7 March 2012 13:52, Tyler Jameson Little wrote:
> I hope this is the right place to ask this.
>
> libuv is the evented IO library that nodejs uses internally. It is basically
> glue for a bunch of other libraries (libev, c-ares, libeio and others).
>
> https://github.com/joyent/libuv
>
> Is the
I hope this is the right place to ask this.
libuv is the evented IO library that nodejs uses internally. It
is basically glue for a bunch of other libraries (libev, c-ares,
libeio and others).
https://github.com/joyent/libuv
Is there already working on a wrapper? I would very much like to
u
H. S. Teoh:
> But why can't 'this' be const? For example, why does the compiler reject
> this:
>
> class A {
> int[] data;
> pure const int sum() {
> return reduce!"a*b"(data);
> }
> }
>
> I'm not modifying data at at al
On Tuesday, March 06, 2012 11:31:40 Jacob Carlborg wrote:
> On 2012-03-06 08:56, Jonathan M Davis wrote:
> > On Tuesday, March 06, 2012 08:29:53 Jacob Carlborg wrote:
> >> On 2012-03-06 02:21, Jonathan M Davis wrote:
> >>> On Tuesday, March 06, 2012 01:53:02 Zach the Mystic wrote:
> Reading th
On Tuesday, March 06, 2012 14:41:01 H. S. Teoh wrote:
> Why is std.algorithm.reduce not marked pure? It makes it impossible to
> do things like this:
>
> pure const int product(int[] args) {
> return reduce!"a * b"(args);
> }
You'd have to look through the implementation and possibly tweak it to
On Tuesday, 6 March 2012 at 23:19:03 UTC, H. S. Teoh wrote:
On Wed, Mar 07, 2012 at 12:13:54AM +0100, Chris Pons wrote:
I'm trying to update a string easily whenever I change a
numeric
component of the string. I've tried to do this so far with no
result:
[...]
Try this:
import std.co
On Wed, Mar 07, 2012 at 12:13:54AM +0100, Chris Pons wrote:
> I'm trying to update a string easily whenever I change a numeric
> component of the string. I've tried to do this so far with no
> result:
[...]
Try this:
import std.conv;
...
int i = 1234;
string s = to
On 3/6/12, Trass3r wrote:
> Sadly, using regular expressions is much more efficient.
Do you have some script that does that and sorta works? I've tried
others (e.g. dstep but couldn't get LLVM to compile unfortunately..).
On Tue, Mar 06, 2012 at 11:40:19PM +0100, Artur Skawina wrote:
> On 03/06/12 20:37, H. S. Teoh wrote:
> > On Tue, Mar 06, 2012 at 01:51:51AM +0100, Artur Skawina wrote:
> > [...]
> >> class A {
> >>string prop1;
> >>int prop2;
> >>
> >>void serialize(this THIS)() {
> >> __serializ
I'm trying to update a string easily whenever I change a numeric
component of the string. I've tried to do this so far with no
result:
while( testInt < 10 )
string testString = "Test ";
int testInt = 0;
testString ~= toString(testInt)
testInt++;
or this:
testString ~= cast(string)(testInt)
B
On Tue, Mar 06, 2012 at 03:00:16PM -0800, H. S. Teoh wrote:
[...]
> But why can't 'this' be const? For example, why does the compiler
> reject this:
>
> class A {
> int[] data;
> pure const int sum() {
> return reduce!"a*b"(data);
>
On Tue, Mar 06, 2012 at 11:51:05PM +0100, Adam D. Ruppe wrote:
> On Tuesday, 6 March 2012 at 22:48:30 UTC, H. S. Teoh wrote:
> >Oh? what's wrong with the const?
>
> test10.d(3): Error: function test10.product without 'this' cannot be
> const/immutable
>
> It works if you put parens on it:
>
>
On Tuesday, 6 March 2012 at 22:48:30 UTC, H. S. Teoh wrote:
Oh? what's wrong with the const?
test10.d(3): Error: function test10.product without 'this' cannot
be const/immutable
It works if you put parens on it:
pure const(int) product(int[] args) {
Without the parenthesis, D want
On Tue, Mar 06, 2012 at 11:42:00PM +0100, Adam D. Ruppe wrote:
> On Tuesday, 6 March 2012 at 22:39:20 UTC, H. S. Teoh wrote:
> >Why is std.algorithm.reduce not marked pure?
>
> It doesn't have to be - templates are inferred to be
> pure or not.
>
> If you take the const off that signature, your e
Am 06.03.2012, 20:13 Uhr, schrieb maarten van damme
:
I wouldn't say that it sucks. It has really helped a lot in
porting some simple header files. It goes terribly bad on the more
complex though.
Sadly, using regular expressions is much more efficient.
At least those don't destroy the so
On Tuesday, 6 March 2012 at 22:39:20 UTC, H. S. Teoh wrote:
Why is std.algorithm.reduce not marked pure?
It doesn't have to be - templates are inferred to be
pure or not.
If you take the const off that signature, your example
works in today's dmd.
On 03/06/12 20:37, H. S. Teoh wrote:
> On Tue, Mar 06, 2012 at 01:51:51AM +0100, Artur Skawina wrote:
> [...]
>> class A {
>>string prop1;
>>int prop2;
>>
>>void serialize(this THIS)() {
>> __serialize(cast(THIS*)&this);
>>}
>> }
>>
>> void __serialize(T)(T* obj) {
>>write
Why is std.algorithm.reduce not marked pure? It makes it impossible to
do things like this:
pure const int product(int[] args) {
return reduce!"a * b"(args);
}
T
--
Life is unfair. Ask too much from it, and it may decide you don't deserve what
you have now eith
You can use a cast as a workaround:
A[] objs = [cast(A)new B, new C ];
This bug has been around for a while, the first time I've seen it
mentioned was in the second code snippet in this blog post:
http://klickverbot.at/blog/2010/11/announcing-d-support-in-swig/
Thanks Trass3r.
On Tue, Mar 6, 2012, at 05:50 PM, Trass3r wrote:
> > Why is 'const' removed?
>
> cause htod sucks.
> D1 didn't have const and htod wasn't updated for ages.
>
On Tue, 06 Mar 2012 20:27:56 +0100, H. S. Teoh
wrote:
Code:
// test.d
class A {}
class B : A {}
class C : A {}
void main() {
A[] objs = [ new B, new C ];// line 6
}
Compiler error:
test.d(6): Error: cannot implicitly conv
On 03/06/2012 11:27 AM, H. S. Teoh wrote:
Code:
// test.d
class A {}
class B : A {}
class C : A {}
void main() {
A[] objs = [ new B, new C ];// line 6
}
Compiler error:
test.d(6): Error: cannot implicitly convert expre
On 03/06/2012 08:37 PM, H. S. Teoh wrote:
On Tue, Mar 06, 2012 at 01:51:51AM +0100, Artur Skawina wrote:
[...]
class A {
string prop1;
int prop2;
void serialize(this THIS)() {
__serialize(cast(THIS*)&this);
}
}
void __serialize(T)(T* obj) {
writef("%s {\n", typeid(*o
On Tue, Mar 06, 2012 at 01:51:51AM +0100, Artur Skawina wrote:
[...]
> class A {
>string prop1;
>int prop2;
>
>void serialize(this THIS)() {
> __serialize(cast(THIS*)&this);
>}
> }
>
> void __serialize(T)(T* obj) {
>writef("%s {\n", typeid(*obj));
>foreach (name; __t
Code:
// test.d
class A {}
class B : A {}
class C : A {}
void main() {
A[] objs = [ new B, new C ];// line 6
}
Compiler error:
test.d(6): Error: cannot implicitly convert expression (new B) of type
test.A to test.C
trass3r, I wouldn't say that it sucks. It has really helped a lot in
porting some simple header files. It goes terribly bad on the more complex
though.
Le 06/03/2012 05:34, Tyler Jameson Little a écrit :
I've been playing with libev in D lately, and I've run into a problem.
I've been able to hack around it, but it'd like to find a better, more
general solution. Here's a link to the code:
https://github.com/beatgammit/fun-with-d/blob/master/libe
On Tue, Mar 06, 2012 at 08:17:07AM +0100, Jacob Carlborg wrote:
> On 2012-03-05 21:16, H. S. Teoh wrote:
> >I know D doesn't really have RTTI yet, but I'm experimenting with
> >"faking" it by doing something like:
> >
> > class A {
> > string prop1;
> > int prop2;
> >
On 2012-03-05 09:38, Dmitry Olshansky wrote:
...
while(working){
if(select(set, null, null, 10) > 0){ //10 usec wait on a socket, may do
plain 0
sock.accept(); // no blocking here
}
set.reset();
set.add(sock);
receiveTimeout(dur!"us"(1), (int code){ working = false; });
}
...
Thanks for the an
Why is 'const' removed?
cause htod sucks.
D1 didn't have const and htod wasn't updated for ages.
I have this file tmp.h:
const char *getvalue(const char *key);
I run htod tmp.h and I've got the output
---
/* Converted to D from tmp.h by htod */
module tmp;
//C const char *getvalue(const char *key);
extern (C):
char * getvalue(char *key);
-
Hi Ali,
only today I had the time to implement your suggestion it's
working now has expected.
Thank you for your patience, also thank you for the work
translating such a good D book to English.
On Friday, 2 March 2012 at 00:00:10 UTC, Ali Çehreli wrote:
On 03/01/2012 03:46 PM, albatroz wr
Hmm somehow I missed that. Thanks.
On 3/6/12, Ali Çehreli wrote:
> On 03/05/2012 04:32 PM, Andrej Mitrovic wrote:
>> There's a really useful function 'translate' in std.string, used like
>> this:
>>
>> __gshared dchar[dchar] MangleTable;
>>
>> shared static this()
>> {
>> MangleTable =
>>
On 03/06/2012 01:51 AM, Artur Skawina wrote:
...
Real programmers don't use mixins, :^)
You got it reverse.
On 2012-03-06 08:56, Jonathan M Davis wrote:
On Tuesday, March 06, 2012 08:29:53 Jacob Carlborg wrote:
On 2012-03-06 02:21, Jonathan M Davis wrote:
On Tuesday, March 06, 2012 01:53:02 Zach the Mystic wrote:
Reading the documentation about compiler options and flags here:
http://dlang.org/dmd-o
48 matches
Mail list logo