Tnx, chcp 65001 and Lucida font out correct string.
On Tuesday, April 01, 2014 03:54:07 Jonathan M Davis wrote:
On Tuesday, April 01, 2014 05:35:28 ed wrote:
OK, lazy me just read the std.satetime article again. It appears
the design is for no invalid values and it is currently a known
limitation due to CTFE.
---
d_time_nan There is
I have 2 modules:
module A;
public class A {
private static void foo() {}
public static void foo(int) {}
}
module B;
import A;
public class B {
public static void bar() { A.foo(0); }
}
Error: class A.A member foo is not accessible
On Wednesday, 2 April 2014 at 22:07:36 UTC, FreeSlave wrote:
Contents of struct are compared field by field using comparison
for the type of each field. Dynamic arrays are compared by
contents. If you want to compare them by pointer use .ptr
property.
opEquals and opCmp are not about
I often have trouble finding documentation for keywords such as
in and is in D. Also, functions like find I expect to be
in std.string but it's actually in std.algorithm and Tuple I
expect to be in std.typetuple but it's actually in std.typecons.
These make sense in retrospect, but it would
If two dynamic arrays point to the same place in memory, is it
fast to compare them for equality? or does every element still
have to be compared?
To make a struct a valid key type, do I need to implement both
opCmp and opEquals or just one or the other? It says on the page
about associative arrays: The implementation may use either
opEquals or opCmp or both. Does that mean it uses whichever one
is user-defined (or both if they're both
On Thursday, 3 April 2014 at 06:23:40 UTC, Jonathan M Davis wrote:
On Tuesday, April 01, 2014 03:54:07 Jonathan M Davis wrote:
On Tuesday, April 01, 2014 05:35:28 ed wrote:
OK, lazy me just read the std.satetime article again. It
appears
the design is for no invalid values and it is
On 04/03/2014 09:03 AM, dnspies wrote:
If two dynamic arrays point to the same place in memory, is it fast to
compare them for equality? or does every element still have to be compared?
Equals will first check for memory location.
This is from the runtime:
bool opEquals(Object lhs, Object
On Thursday, 3 April 2014 at 07:16:53 UTC, simendsjo wrote:
On 04/03/2014 09:03 AM, dnspies wrote:
If two dynamic arrays point to the same place in memory, is it
fast to
compare them for equality? or does every element still have to
be compared?
Equals will first check for memory location.
On Thursday, 3 April 2014 at 06:44:54 UTC, Domain wrote:
I have 2 modules:
module A;
public class A {
private static void foo() {}
public static void foo(int) {}
}
module B;
import A;
public class B {
public static void bar() { A.foo(0); }
}
Error: class A.A member foo is not
On Thursday, 3 April 2014 at 07:03:26 UTC, dnspies wrote:
If two dynamic arrays point to the same place in memory, is it
fast to compare them for equality? or does every element still
have to be compared?
Depends how you test for equality.
If you use is, the opEquals will straight up check
On 04/03/2014 09:23 AM, dnspies wrote:
On Thursday, 3 April 2014 at 07:16:53 UTC, simendsjo wrote:
On 04/03/2014 09:03 AM, dnspies wrote:
If two dynamic arrays point to the same place in memory, is it fast to
compare them for equality? or does every element still have to be
compared?
Equals
On Thursday, 3 April 2014 at 04:58:12 UTC, Joel wrote:
It says in the Language Reference not to use system and gives
other options. But the other options don't seem to work. I just
have code system(clear);
Try this: http://dlang.org/phobos/std_process.html#.executeShell
On Thursday, 3 April 2014 at 06:59:45 UTC, dnspies wrote:
I often have trouble finding documentation for keywords such as
in and is in D. Also, functions like find I expect to be
in std.string but it's actually in std.algorithm and Tuple I
expect to be in std.typetuple but it's actually in
On Thursday, April 03, 2014 07:10:06 dnspies wrote:
To make a struct a valid key type, do I need to implement both
opCmp and opEquals or just one or the other? It says on the page
about associative arrays: The implementation may use either
opEquals or opCmp or both. Does that mean it uses
On Thursday, 3 April 2014 at 10:15:46 UTC, Jonathan M Davis wrote:
_Any_ type which overloads both opEquals and opCmp and does not
make them
match exactly is just plain broken.
I disagree:
If a.opEquals(b) is true, then a.opCmp(b) must be 0.
If a.opCmp(b) is non-zero, then a.opEquals(b)
On Wednesday, 2 April 2014 at 21:54:58 UTC, FreeSlave wrote:
It's only server. Maybe problem is on client side.
Yes, it is only a server which needs to answer back the client;
And there was the problem: I was not fetching the client's
address, and since UDP is an unconnected protocol, I
On Thursday, 3 April 2014 at 10:42:33 UTC, monarch_dodra wrote:
A correctly implemented AA would use opCmp to store objects in
each bucket in cases of hash collisions, but still use opEqual
in case of equivalence.
I would add to that, try to use opCmp if it is available. It
should be
On Monday, 31 March 2014 at 11:51:50 UTC, Olav Lindekleiv wrote:
Here's the issue:
http://d.puremagic.com/issues/show_bug.cgi?id=12498
Fixed in git-head.
https://github.com/D-Programming-Language/dmd/commit/2c4d8ad711ccb7c94d349830523dd500580b0130
Kenji Hara
On Thursday, 3 April 2014 at 09:27:29 UTC, Gary Willoughby wrote:
On Thursday, 3 April 2014 at 06:59:45 UTC, dnspies wrote:
I often have trouble finding documentation for keywords such
as in and is in D. Also, functions like find I expect
to be in std.string but it's actually in std.algorithm
On Thursday, 3 April 2014 at 08:27:38 UTC, simendsjo wrote:
On 04/03/2014 09:23 AM, dnspies wrote:
On Thursday, 3 April 2014 at 07:16:53 UTC, simendsjo wrote:
On 04/03/2014 09:03 AM, dnspies wrote:
If two dynamic arrays point to the same place in memory, is
it fast to
compare them for
dnspies:
I still don't know where to find documentation for is (which
I just found out in another forum post is overloaded for
dynamic arrays). Can users overload the meaning of is
themselves?
Here you find info on the D language:
http://dlang.org/spec.html
is is an operator, so it's an
On Thursday, 3 April 2014 at 10:42:33 UTC, monarch_dodra wrote:
On Thursday, 3 April 2014 at 10:15:46 UTC, Jonathan M Davis
wrote:
_Any_ type which overloads both opEquals and opCmp and does
not make them
match exactly is just plain broken.
I disagree:
If a.opEquals(b) is true, then
On Thursday, 3 April 2014 at 16:10:45 UTC, bearophile wrote:
dnspies:
I still don't know where to find documentation for is (which
I just found out in another forum post is overloaded for
dynamic arrays). Can users overload the meaning of is
themselves?
Here you find info on the D
On 04/03/2014 06:31 PM, dnspies wrote:
On Thursday, 3 April 2014 at 16:10:45 UTC, bearophile wrote:
dnspies:
I still don't know where to find documentation for is (which I just
found out in another forum post is overloaded for dynamic arrays).
Can users overload the meaning of is themselves?
On Thursday, 3 April 2014 at 16:05:27 UTC, dnspies wrote:
But I still don't see how this opEquals which takes two Objects
could possibly accept dynamic arrays instead.
It doesn't. The link you were given was not relevent.
Object is a class-type so its instances can only be accessed by
On Monday, 31 March 2014 at 19:05:11 UTC, Matt Soucy wrote:
On 03/31/2014 02:59 PM, nrgyzer wrote:
Hi guys,
I updated my dmd version from 2.0.63 to 2.0.65 and having some
trouble
with my JSON-definitions. The code below worked in 2.0.63 but
not in
2.0.65:
JSONValue oJson = JSONValue();
On Thu, 03 Apr 2014 06:42:32 -0400, monarch_dodra monarchdo...@gmail.com
wrote:
On Thursday, 3 April 2014 at 10:15:46 UTC, Jonathan M Davis wrote:
_Any_ type which overloads both opEquals and opCmp and does not make
them
match exactly is just plain broken.
I disagree:
If a.opEquals(b)
On Thursday, 3 April 2014 at 16:39:02 UTC, simendsjo wrote:
On 04/03/2014 06:31 PM, dnspies wrote:
On Thursday, 3 April 2014 at 16:10:45 UTC, bearophile wrote:
dnspies:
I still don't know where to find documentation for is
(which I just
found out in another forum post is overloaded for
After being downvoted on stackoverflow for no apperant reason, I
figured I'd give it a shot here.
How do I pass a delegate to an external C function taking a
function pointer?
If you want some extra rep on StackOverflow you can also answer
here:
On Thu, 03 Apr 2014 17:59:30 +, Jeroen Bollen wrote:
After being downvoted on stackoverflow for no apperant reason, I figured
I'd give it a shot here.
How do I pass a delegate to an external C function taking a function
pointer?
If you want some extra rep on StackOverflow you can
On Thursday, 3 April 2014 at 18:05:26 UTC, Justin Whear wrote:
On Thu, 03 Apr 2014 17:59:30 +, Jeroen Bollen wrote:
After being downvoted on stackoverflow for no apperant reason,
I figured
I'd give it a shot here.
How do I pass a delegate to an external C function taking a
function
On Thursday, 3 April 2014 at 17:59:33 UTC, Jeroen Bollen wrote:
How do I pass a delegate to an external C function taking a
function pointer?
You can't do it directly in general, unless you can modify the C
function, then you can hack around it, but a delegate and a
regular function pointer
On Thursday, 3 April 2014 at 18:13:31 UTC, Adam D. Ruppe wrote:
On Thursday, 3 April 2014 at 17:59:33 UTC, Jeroen Bollen wrote:
How do I pass a delegate to an external C function taking a
function pointer?
You can't do it directly in general, unless you can modify the
C function, then you
On Thursday, 3 April 2014 at 16:47:05 UTC, Steven Schveighoffer
wrote:
On Thu, 03 Apr 2014 06:42:32 -0400, monarch_dodra
monarchdo...@gmail.com wrote:
On Thursday, 3 April 2014 at 10:15:46 UTC, Jonathan M Davis
wrote:
_Any_ type which overloads both opEquals and opCmp and does
not make them
On Thu, 03 Apr 2014 14:45:40 -0400, monarch_dodra monarchdo...@gmail.com
wrote:
On Thursday, 3 April 2014 at 16:47:05 UTC, Steven Schveighoffer wrote:
This can lead to false positives if opCmp(x, y) == 0 is assumed to mean
equal.
An example: if you used RBTree to store 2d points, and
On 04/03/2014 06:50 PM, dnspies wrote:
On Thursday, 3 April 2014 at 16:39:02 UTC, simendsjo wrote:
On 04/03/2014 06:31 PM, dnspies wrote:
On Thursday, 3 April 2014 at 16:10:45 UTC, bearophile wrote:
dnspies:
I still don't know where to find documentation for is (which I just
found out in
On Wednesday, 2 April 2014 at 20:39:47 UTC, FreeSlave wrote:
On Wednesday, 2 April 2014 at 20:14:31 UTC, dnspies wrote:
How can I get the default-hash of a struct I've defined (to be
used as part of the hash for some containing type)?
UserDefined userDefined;
dnspies:
This doesn't work. It prints two different hashes for equal
objects. I meant how do I get the default hash which is used
by an associative array.
import std.stdio;
struct my_struct {
int[] arr;
}
void main() {
my_struct s1;
s1.arr = [1,2,3];
1). Is there a way to import an enum so that you don't need
to qualify each instance with the type name? Something like
java does with its static import.
2). It seems that you can't use an enum of struct or class type
in a switch statement. This seems inconsistent. Would it make
sense to
Eric:
1). Is there a way to import an enum so that you don't need
to qualify each instance with the type name? Something like
java does with its static import.
In some cases you can use the handy with() statement for that
purpose.
One example usages:
final switch (foo) with (MyEnum) {
In some cases you can use the handy with() statement for that
purpose.
One example usages:
final switch (foo) with (MyEnum) {
...
}
Okay - the with statement may help in some cases. I'll
have to try it out...
Using an enumeration of class instances isn't a good idea, they
are
Eric:
I disagree. If you just think of a class type enum as a class
type,
then what you say makes sense. But if you instead think of it
as a more powerful enum then it can enhance data safety in a
program.
I was speaking about the current D enum, as implemented and as
designed. Regarding
On Thursday, 3 April 2014 at 21:42:18 UTC, bearophile wrote:
dnspies:
This doesn't work. It prints two different hashes for equal
objects. I meant how do I get the default hash which is used
by an associative array.
import std.stdio;
struct my_struct {
int[] arr;
}
void main() {
On Thu, 03 Apr 2014 17:42:16 -0400, bearophile bearophileh...@lycos.com
wrote:
I have filed this big problem four years ago or more.
Bug report?
-Steve
Steven Schveighoffer:
Bug report?
I don't remember, sorry, it's an ancient problem. Probably one of
my top three D problems :-)
Bye,
bearophile
dnspies:
Oh so the problem isn't that that ISN'T the default hash used
...
everything which is the opposite of true.
You can post an elaboration of this in the main D newsgroup.
Bye,
bearophile
On Thursday, 3 April 2014 at 22:34:19 UTC, bearophile wrote:
Eric:
I disagree. If you just think of a class type enum as a class
type,
then what you say makes sense. But if you instead think of it
as a more powerful enum then it can enhance data safety in a
program.
I was speaking about
Hello,
Say I compile a program with:
dmd -unittest -debug -cov test.d
Then, when I run ./test, a file 'test.lst' is generated in the
current working directory. Is there a way in which I can instruct
the file to be created in a separate './cov_log/' directory?
Thanks,
Saurabh
After reading some of the bug reports on BugZilla, I gather that
this isn't possible yet :(
Thanks,
Saurabh
On Friday, 4 April 2014 at 04:10:51 UTC, Saurabh Das wrote:
Hello,
Say I compile a program with:
dmd -unittest -debug -cov test.d
Then, when I run ./test, a file 'test.lst' is
If you have a templated type, is there a way to get the compile-time
parameters it was instantiated with?
Ie:
--
struct Foo(T) {}
alias MyFoo = Foo!int;
--
Is there a way to inspect MyFoo to get its T type (in this case, 'int')?
*Without* actually
On 04/03/2014 09:10 PM, Saurabh Das wrote:
Say I compile a program with:
dmd -unittest -debug -cov test.d
So, that's what the makefile generates. ;) You can have an additional
line that moves the coverage file away.
Ali
On Friday, 4 April 2014 at 04:44:56 UTC, Nick Sabalausky wrote:
If you have a templated type, is there a way to get the
compile-time parameters it was instantiated with?
Ie:
--
struct Foo(T) {}
alias MyFoo = Foo!int;
--
Is there a way to inspect MyFoo
On 4/4/2014 1:02 AM, Meta wrote:
alias TemplateArgs(T: Foo!U, U) = U;
void main()
{
assert(is(TemplateArgs!MyFoo == int));
}
Ahh thanks.
On Thursday, 3 April 2014 at 17:59:33 UTC, Jeroen Bollen wrote:
After being downvoted on stackoverflow for no apperant reason,
I figured I'd give it a shot here.
How do I pass a delegate to an external C function taking a
function pointer?
If you want some extra rep on StackOverflow you can
On Friday, 4 April 2014 at 05:20:42 UTC, Mengu wrote:
On Thursday, 3 April 2014 at 17:59:33 UTC, Jeroen Bollen wrote:
After being downvoted on stackoverflow for no apperant reason,
I figured I'd give it a shot here.
How do I pass a delegate to an external C function taking a
function
57 matches
Mail list logo