On 05/16/2013 09:21 PM, Maxim Fomin wrote:
> On Thursday, 16 May 2013 at 22:53:56 UTC, Jack Applegame wrote:
>> Look at this code:
>>> import std.stdio;
>>>
>>> class Foo {
>>> int value = 123456;
>>> }
>>>
>>> struct Bar {
>>> this(Foo f) { foo = f; }
>>> @property auto lambda() {
>>> return (){
On Thursday, 16 May 2013 at 22:53:56 UTC, Jack Applegame wrote:
Look at this code:
import std.stdio;
class Foo {
int value = 123456;
}
struct Bar {
this(Foo f) { foo = f; }
@property auto lambda() {
return (){ writefln("value = %s", foo.value); };
}
Foo foo;
}
auto getLambda(Foo f) {
return
Look at this code:
import std.stdio;
class Foo {
int value = 123456;
}
struct Bar {
this(Foo f) { foo = f; }
@property auto lambda() {
return (){ writefln("value = %s", foo.value); };
}
Foo foo;
}
auto getLambda(Foo f) {
return Bar(f).lambda; // lambda closure points to temporary
Bar
16-May-2013 13:31, Maxim Fomin пишет:
On Thursday, 16 May 2013 at 09:05:46 UTC, Dicebot wrote:
On Wednesday, 15 May 2013 at 19:30:41 UTC, Dmitry Olshansky wrote:
Won't this work?
*cast(void**)&object
Right question is "is this guaranteed to work by spec?".
Spec is silent about this but in p
On Thursday, 16 May 2013 at 06:21:06 UTC, Namespace wrote:
On Thursday, 16 May 2013 at 06:08:30 UTC, gedaiu wrote:
Does the garbage collector manages the memory from extern(C)
functions, or we have to delete manualy the objects created in
those kind of functions?
Thanks,
Bogdan
You mean som
On Thursday, May 16, 2013 16:00:58 Andrej Mitrovic wrote:
> I was using the AE[1] library, but recently it started to fail to
> compile due to essentially this:
>
>
> import std.datetime;
>
> void main()
> {
> Duration dur;
> auto x = new SimpleTimeZone(dur);
> }
>
>
> > test.d
On Thu, 16 May 2013 17:01:54 +0200, Sebastian Graf
wrote:
I aim to use a simplistic, rough edged property generator, but
I'm having issues.
See http://dpaste.dzfl.pl/72837a7a.
My code and mixin logic seems to work basically, but it gets
hairy when using mixinMap to generate getters and setter
On 5/16/13, Byron Heads wrote:
> On Thu, 16 May 2013 08:11:35 -0500, 1100110 wrote:
>>
>> __traits(classInstanceSize, MyClass); ?
>
> Any ideas on how to get the element type of an array
> ie: int[] -> int int[][] -> int[]
Try the ElementType template in std.range. There's also ElementEncod
I aim to use a simplistic, rough edged property generator, but
I'm having issues.
See http://dpaste.dzfl.pl/72837a7a.
My code and mixin logic seems to work basically, but it gets
hairy when using mixinMap to generate getters and setters from a
list in a recursive template fashion. It won't work if
On 5/16/13, nazriel wrote:
> I believe it may be related to this:
> http://forum.dlang.org/post/517e4196.9090...@outerproduct.org
>
> http://forum.dlang.org/post/CAFDvkctF-_A=jpp7a+qo43vsqlbg_upnusjjj01vkaeqwbj...@mail.gmail.com
Thanks, that does explain it. I have to put this in the changelog AS
Byron Heads:
Not the most initiative name for the function but works for my
case.<
It has a strange name because a string (that is a dynamic array)
iterated as range (like by map()) has a type different from the
same iterated on default with foreach...
Bye,
bearophile
On Thursday, 16 May 2013 at 14:01:13 UTC, Andrej Mitrovic wrote:
I was using the AE[1] library, but recently it started to fail
to
compile due to essentially this:
import std.datetime;
void main()
{
Duration dur;
auto x = new SimpleTimeZone(dur);
}
test.d(8): Error:
On 5/16/13, Andrej Mitrovic wrote:
> I was using the AE[1] library
[1]: https://github.com/CyberShadow/ae
I was using the AE[1] library, but recently it started to fail to
compile due to essentially this:
import std.datetime;
void main()
{
Duration dur;
auto x = new SimpleTimeZone(dur);
}
> test.d(8): Error: immutable method std.datetime.SimpleTimeZone.this is not
> callab
On Thu, 16 May 2013 13:49:51 +, Byron Heads wrote:
> On Thu, 16 May 2013 08:11:35 -0500, 1100110 wrote:
>>
>> __traits(classInstanceSize, MyClass); ?
>
> Any ideas on how to get the element type of an array ie: int[] -> int
> int[][] -> int[]
>
> I am going to block dynamic arrays wit
On Thu, 16 May 2013 08:11:35 -0500, 1100110 wrote:
>
> __traits(classInstanceSize, MyClass); ?
Any ideas on how to get the element type of an array
ie: int[] -> int int[][] -> int[]
I am going to block dynamic arrays with more then 1D, since they are
holding pointers in the data block
On Thu, 16 May 2013 15:32:35 +0200, bearophile wrote:
> Byron Heads:
>
>> now I am wondering way a POD has a vtable.
>
> In D global structs are PODs, while classe instances are are not PODs.
>
> All classes have a vtable because they inherit some methods from the
> Object class.
>
> Bye,
> be
On 05/16/2013 08:21 AM, Byron Heads wrote:
> On Thu, 16 May 2013 08:11:35 -0500, 1100110 wrote:
>
>> On 05/16/2013 08:09 AM, Byron Heads wrote:
>>> I am working on d-leveldb wrapper (https://github.com/bheads/d-leveldb)
>>> and I need to be able to pass blocks of data between D and leveldb API.
>>
Byron Heads:
now I am wondering way a POD has a vtable.
In D global structs are PODs, while classe instances are are not
PODs.
All classes have a vtable because they inherit some methods from
the Object class.
Bye,
bearophile
On Thu, 16 May 2013 08:11:35 -0500, 1100110 wrote:
> On 05/16/2013 08:09 AM, Byron Heads wrote:
>> I am working on d-leveldb wrapper (https://github.com/bheads/d-leveldb)
>> and I need to be able to pass blocks of data between D and leveldb API.
>> I am having rouble getting the byte size of dynam
On 05/16/2013 08:09 AM, Byron Heads wrote:
> I am working on d-leveldb wrapper (https://github.com/bheads/d-leveldb)
> and I need to be able to pass blocks of data between D and leveldb API.
> I am having rouble getting the byte size of dynamic arrays and POD
> classes.
>
> I can get the right s
I am working on d-leveldb wrapper (https://github.com/bheads/d-leveldb)
and I need to be able to pass blocks of data between D and leveldb API.
I am having rouble getting the byte size of dynamic arrays and POD
classes.
I can get the right size for 1D dynamic arrays, need a way to compute the
t
On 5/16/13, Jack Applegame wrote:
> Why this doesn't compile?
I think this is a bug.
This code compiles , as expected
struct A {
void func(string s : "foo")() {
pragma(msg, "func for foo");
}
void func(string s)() {
pragma(msg, "func for others: " ~ s);
}
}
void main() {
A a;
a.func!"foo"();
a.func!"bar"();
I implemented the Maybe monad using template specialization.
Feedback welcome!
https://bitbucket.org/qznc/d-monad/src/ba39f2551af0e2e90a40653af92c048fed519a18/generic.d?at=master
However, a few questions or possibly shortcomings of D came up.
1. I could not specify the inheritance between the
Am 15.05.2013 17:08, schrieb Artur Skawina:
> On 05/15/13 13:04, Dicebot wrote:
>> On Wednesday, 15 May 2013 at 10:31:29 UTC, David wrote:
"&c" is address of reference, no class instance. I don't know if there
is a way to get a pointer to class instance in D but I am not aware of one.
>>>
On Thursday, 16 May 2013 at 09:31:11 UTC, Maxim Fomin wrote:
On Thursday, 16 May 2013 at 09:05:46 UTC, Dicebot wrote:
On Wednesday, 15 May 2013 at 19:30:41 UTC, Dmitry Olshansky
wrote:
Won't this work?
*cast(void**)&object
Right question is "is this guaranteed to work by spec?".
Spec is sil
interface with C++ for example (for example extern(C++) classes )
On Thu, May 16, 2013 at 2:31 AM, Maxim Fomin wrote:
> On Thursday, 16 May 2013 at 09:05:46 UTC, Dicebot wrote:
>
>> On Wednesday, 15 May 2013 at 19:30:41 UTC, Dmitry Olshansky wrote:
>>
>>> Won't this work?
>>> *cast(void**)&objec
On Thursday, 16 May 2013 at 09:05:46 UTC, Dicebot wrote:
On Wednesday, 15 May 2013 at 19:30:41 UTC, Dmitry Olshansky
wrote:
Won't this work?
*cast(void**)&object
Right question is "is this guaranteed to work by spec?".
Spec is silent about this but in practice this should work. Real
questio
On Wednesday, 15 May 2013 at 19:30:41 UTC, Dmitry Olshansky wrote:
Won't this work?
*cast(void**)&object
Right question is "is this guaranteed to work by spec?".
On Thursday, May 16, 2013 01:15:06 Timothee Cour wrote:
> > as far as I can tell, it means exactly what it says, and I don't know how
>
> it could be friendlier.
>
> the error message 'declaration fun is already defined' is surprising
> because 'void fun(int x);' and 'void fun();' are typically 2
> as far as I can tell, it means exactly what it says, and I don't know how
it could be friendlier.
the error message 'declaration fun is already defined' is surprising
because 'void fun(int x);' and 'void fun();' are typically 2 different
function declarations, having different signatures. So thi
If I change formattedRead's input signature to:
uint formattedRead(R, Char, S...)(ref R r, const(Char)[] fmt, ref S args)
and adjusted code accordingly.
It seems to work fine.
see implementation here:
https://github.com/timotheecour/dtools/blob/master/dtools/overrides/format.d#L29
(just run unitt
On Thursday, May 16, 2013 00:28:15 Timothee Cour wrote:
> at the very least (or until it gets fixed) dmd should emit a more friendly
> error message:
> 'cannot overload a function in a nested scope'
> otherwise this is hard to understand.
I don't know what else it would say. It means exactly what
at the very least (or until it gets fixed) dmd should emit a more friendly
error message:
'cannot overload a function in a nested scope'
otherwise this is hard to understand.
On Wed, May 15, 2013 at 11:43 PM, Jonathan M Davis wrote:
> On Wednesday, May 15, 2013 20:48:19 Steven Schveighoffer wrote
35 matches
Mail list logo