On Saturday, 10 November 2012 at 18:35:57 UTC, Jonathan M Davis
wrote:
Object-oriented code not use virtual functions much? If you
don't need virtual
functions, then use a struct, not a class. Classes are
polymorphic. Structs
are not. In general, it doesn't make a lot of sense to use a
class
On Sunday, 11 November 2012 at 02:55:09 UTC, Alex Rønne Petersen
wrote:
Can you give a self-contained repro that illustrates the
problem?
Also, please use core.sys.windows.windows instead. The std.c.*
package is going to be deprecated soon-ish.
import core.sys.windows.windows;
void main()
{
On Sunday, 11 November 2012 at 02:55:09 UTC, Alex Rønne Petersen
wrote:
Can you give a self-contained repro that illustrates the
problem?
Also, please use core.sys.windows.windows instead. The std.c.*
package is going to be deprecated soon-ish.
import core.sys.windows.windows;
void main()
{
On 11-11-2012 02:49, cal wrote:
I want to call Windows api function VirtualAlloc. I include
std.c.windows.windows but get the following error from dmd 2.061 (and
2.060):
Error: no size for type nothrow extern (Windows) int()
What does this message mean? If I provide my own prototype of the
func
I want to call Windows api function VirtualAlloc. I include
std.c.windows.windows but get the following error from dmd 2.061
(and 2.060):
Error: no size for type nothrow extern (Windows) int()
What does this message mean? If I provide my own prototype of the
function, same error.
On 11/10/2012 05:37 AM, Joseph Rushton Wakeling wrote:
> On 11/07/2012 07:38 AM, "Raphaël.Jakse"
> "@puremagic.com wrote:
>> We want to be able to get the hash of s. Therefore, we re-implement
>> the toHash
>> method of the Student class :
>
> OK, now I'm curious. Assuming I don't write a custom r
On 11/10/12, nixda wrote:
> You can try vibe.d bson serialization.
> http://vibed.org/api/vibe.data.bson/serializeToBson
It doesn't handle them either. Anyway I've implemented it for msgpack
(took a whole of 30 minutes, it's a great and readable codebase), I
just have to write some more extensive
You can try vibe.d bson serialization.
http://vibed.org/api/vibe.data.bson/serializeToBson
On Saturday, 10 November 2012 at 21:23:03 UTC, Andrej Mitrovic
wrote:
11/10/12, Andrej Mitrovic wrote:
I've been using msgpack for a while, unfortunately I've just
discovered it doesn't support serial
11/10/12, Andrej Mitrovic wrote:
> I've been using msgpack for a while, unfortunately I've just
> discovered it doesn't support serializing circular references
> (http://jira.msgpack.org/browse/MSGPACK-81)
Anyway I think I'll be able to hack-in circular reference support to
msgpack, but it's not
On 11/10/12, Jacob Carlborg wrote:
> Although Orange is probably not very fast and it currently only has an
> XML archive.
Heh yeah I'm actually reading XML into classes and then want to
serialize this for faster access when re-running the app, so it
probably wouldn't be a good idea to serialize
On 2012-11-10 13:42, Andrej Mitrovic wrote:
Orange doesn't work with circular references either. Is there any
other serialization library that supports this scenario? I'm looking
for something fast, and binary format is ok, I don't need a
user-readable format.
If Orange doesn't work with circu
I've been using msgpack for a while, unfortunately I've just
discovered it doesn't support serializing circular references
(http://jira.msgpack.org/browse/MSGPACK-81), e.g.:
import msgpack;
class Foo
{
int x;
Bar obj;
}
class Bar
{
int x;
Foo obj;
}
void main()
{
auto foo =
On Saturday, 10 November 2012 at 18:18:07 UTC, Joseph Rushton
Wakeling wrote:
On 11/07/2012 07:38 AM, "Raphaël.Jakse"
"@puremagic.com wrote:
We want to be able to get the hash of s. Therefore, we
re-implement the toHash
method of the Student class :
OK, now I'm curious. Assuming I don't writ
On Saturday, November 10, 2012 11:03:31 Jacob Carlborg wrote:
> On 2012-11-10 06:28, Jonathan M Davis wrote:
> > package restricts access to the same package. D has no concept like C#'s
> > internal, because it doesn't have assemblies.
>
> I'm not entirely sure how assemblies work in C# but couldn
On 11/09/12 23:45, Timon Gehr wrote:
> On 11/09/2012 10:24 PM, Philippe Sigaud wrote:
>>
>> Timon:
>>
>> The D front end I am developing can already handle it.
>>
>>
>> Developed in D, I suppose?
>>
>
> Yes.
Public? License? URL?
artur
On Saturday, November 10, 2012 08:28:00 goofwin wrote:
> I think that it is unsuccessful decision by the language
> designers, because object oriented code use virtual functions not
> much in most cases, thence it is useless and bad for performance
> or it causes developer to set public and protect
On 11/07/2012 07:38 AM, "Raphaël.Jakse" "@puremagic.com
wrote:
We want to be able to get the hash of s. Therefore, we re-implement the toHash
method of the Student class :
OK, now I'm curious. Assuming I don't write a custom re-implementation, how
would a custom struct or class be hashed? (W
Timon Gehr:
The point was that the code you gave should work even without
your proposed enhancement.
So my original question was: do you remember if Hara has already
written a patch to fix that bug? :-)
Bye,
bearophile
I appreciate all the helpful replies, but I've simplified things
to what I belive is the core issue. In C++ (at the risk of
becoming a heretic) the language allows me to do the following:
struct SnonParameterized
{
public:
int t;
float u;
SnonParameterized(int tparam, float uparam);
};
On 2012-11-10 17:48, Timon Gehr wrote:
The length of an array is the number of elements. sizeof(void)==1 and
sizeof(int)==4. The first example reinterprets the ptr and length pair
of the void[] as a ptr and length pair of an int[]. The second example
adjusts the length so that the resulting arra
Timon Gehr wrote:
> But as this is an undecidable property in general
I do not see, that the compiler has to solve the general case---
at least when compiling monolithic code and the executable is
only allowed to use types which are initialized at compile time.
Upon using several modules the mo
On 11/10/2012 05:21 PM, bearophile wrote:
Timon Gehr:
It is strongly pure regardless of potential aliasing in the return
value. This is a bug.
This can't be strongly pure:
int[] foo2(int[] a) pure {
a[0]++;
return a;
}
Bye,
bearophile
The point was that the code you gave shoul
On 11/10/2012 01:20 PM, Jacob Carlborg wrote:
The following example:
void main()
{
void[][size_t] aa;
aa[1] = [1, 2, 3];
if (auto a = 1 in aa)
{
writeln(*(cast(int[]*) a));
writeln(cast(int[]) *a);
}
}
Will print:
[1, 2, 3, 201359280, 0, 0, 0, 0, 0,
On 11/10/2012 10:12 AM, Manfred Nowak wrote:
Timon Gehr wrote:
In theory yes, but
[...]
What a pity. Because in the code given only the types Elem!0 and Elem!1
must be indeed initialized.
...
In this specific case, yes. But as this is an undecidable property in
general, detecting and explo
Timon Gehr:
It is strongly pure regardless of potential aliasing in the
return value. This is a bug.
This can't be strongly pure:
int[] foo2(int[] a) pure {
a[0]++;
return a;
}
Bye,
bearophile
Do you remember if Hara has implemented a patch to allow a2 to be
immutable?
int[] foo1(int x) pure {
return null;
}
int[] foo2(string s) pure {
return null;
}
void main() {
immutable a1 = foo1(10); // OK
immutable a2 = foo2("hello"); // currently error
}
The idea behind this
On Sat, 10 Nov 2012 00:35:05 +0100
"Too Embarrassed To Say" wrote:
>
> auto p3 = Parameterized!(int, double, bool, char)(57, 7.303,
> false, 'Z'); // compiles
> // but not
> // Parameterized!(int, double, bool, char)(93, 5.694, true, 'K')
> p4;
That's as expected. Variable declarations are of
On 11/10/2012 03:32 PM, bearophile wrote:
Do you remember if Hara has implemented a patch to allow a2 to be
immutable?
int[] foo1(int x) pure {
return null;
}
int[] foo2(string s) pure {
return null;
}
void main() {
immutable a1 = foo1(10); // OK
immutable a2 = foo2("hello")
On Saturday, 10 November 2012 at 07:55:18 UTC, Raphaël Jakse
wrote:
Hello,
Thanks for this complete answer. I will take a look to your
code.
Ok - good. I've been using 2.061 which I just realized allows
"dup" on an associative array, a feature which was not available
in 2.060. So mixin(Dup)
On Sat, 10 Nov 2012 10:33:39 + (UTC)
Manfred Nowak wrote:
> Nick Sabalausky wrote:
>
> > I really don't see the relevance
>
> Please look at the definition of R:
> struct R
> {
> int value;
> d_list!R Rlist;
> }
>
> If no recursion was wanted the OP should have written:
> d_lis
The following example:
void main()
{
void[][size_t] aa;
aa[1] = [1, 2, 3];
if (auto a = 1 in aa)
{
writeln(*(cast(int[]*) a));
writeln(cast(int[]) *a);
}
}
Will print:
[1, 2, 3, 201359280, 0, 0, 0, 0, 0, 0, 0, 0]
[1, 2, 3]
The first value seems to contain s
Nick Sabalausky wrote:
> But the OP was never trying to do anything like that.
See digitalmars.D.learn:40991
-manfred
Rob T wrote:
> and the problem I'm experiencing is definitely a compiler bug
I do not see that. Please work on my messages digitalmars.D.learn:40990
and digitalmars.D.learn:40991.
-manfred
Nick Sabalausky wrote:
> I really don't see the relevance
Please look at the definition of R:
struct R
{
int value;
d_list!R Rlist;
}
If no recursion was wanted the OP should have written:
d_list!(R*) Rlist;
In digitalmars.D.learn:40990 I already asked for an explanation.
-manfred
Rob T wrote:
> I want to create a simple recursive data structure as follows:
>
> struct R
> {
> int value;
> d_list!R Rlist;
> }
I do not see any usage for the member `d_list!R Rlist'.
Please explain.
-manfred
On 2012-11-10 06:28, Jonathan M Davis wrote:
package restricts access to the same package. D has no concept like C#'s
internal, because it doesn't have assemblies.
I'm not entirely sure how assemblies work in C# but couldn't one say
that everything in D is internal unless explicitly marked as
Timon Gehr wrote:
> In theory yes, but
[...]
What a pity. Because in the code given only the types Elem!0 and Elem!1
must be indeed initialized.
The fact, that the specification of the template describes a family of
types with an infinite number of members should not force the front end
to ch
Hello,
Thanks for this complete answer. I will take a look to your code.
Additionally, Ali gave me a really interesting link about hashing, good
practices, what is efficient, etc. If you didn't read it, it might
interest you. Here it is:
http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_
38 matches
Mail list logo