Is the following snippet a bug?
---
import core.thread;
import std.stdio, std.concurrency;
void foo(Tid tid) {
send(tid, true);
}
void main() {
auto fooTid = spawn(foo, thisTid);
auto receiveInt = receiveTimeout(dur!seconds(10), (int
isInt) {
writeln(I should not be
On 2012-10-17 19:39, Tyler Jameson Little wrote:
I could make my marshaller/unmarshaller only update objects in place. I
think this is more useful and would remove the overlap between orange
and the JSON library. We could then write a JSON archiver for orange and
include it in std.json as well.
On 2012-10-17 21:44, Tyler Jameson Little wrote:
Here's the updated code. It's got a marshaller and unmarshaller:
https://gist.github.com/3894337
It's about 650 lines. If you have time, I'd be very interested in
getting some feedback (or from anyone else who sees this post of course).
The
On 2012-10-17 20:36, Tyler Jameson Little wrote:
The mentioned solution doesn't account for shared fields from a super
class:
class A { int a; }
class S { int b; }
foreach (i, type; typeof(S.tupleof)) {
enum name = S.tupleof[i].stringof[4..$];
writef((%s)
On 2012-10-17 21:44, Tyler Jameson Little wrote:
Here's the updated code. It's got a marshaller and unmarshaller:
https://gist.github.com/3894337
It's about 650 lines. If you have time, I'd be very interested in
getting some feedback (or from anyone else who sees this post of course).
I'll
On 2012-10-18 05:12, Ellery Newcomer wrote:
nice tip, but adding extern doesn't change link behavior at all.
Hmm, are you linking with the DLL (the import library) ? In not, you
need to use dlopen, or what the corresponding Windows function is.
--
/Jacob Carlborg
Hey guys!
I think I understand the reasoning behind the idea that classes
in the same module are automatically friends, but why isn't
there any way to have this sort of relationship between classes
outside of a module? I feel like there are times when it doesn't
always make sense to have
On Thursday, October 18, 2012 10:09:46 Jeremy DeHaan wrote:
Is there any kind of work around for this functionality?
The package access modifier.
- Jonathan M Davis
On 2012-10-17 22:03, Kagamin wrote:
Can it serialize Variant?
No, but I'm working on it. Actually, it can serialize it, but not
deserialize it.
--
/Jacob Carlborg
On Thursday, 18 October 2012 at 08:12:42 UTC, Jonathan M Davis
wrote:
On Thursday, October 18, 2012 10:09:46 Jeremy DeHaan wrote:
Is there any kind of work around for this functionality?
The package access modifier.
- Jonathan M Davis
You, good sir, are now my new best friend.
Hello
I have struct in one module (vector.d)
struct vec(string S, T=double)
if( is(T:real) onlyASCII(S) )
{
private T[S.length] _data;
alias vec!(S,T) ttype;
alias _data this;
mixin _workaround4424;
auto opAssign(E)( E[] b ) if( is( E : T ) )
{
if( b.length
On Thu, 18 Oct 2012 07:41:16 +0100, Jacob Carlborg d...@me.com wrote:
On 2012-10-18 05:12, Ellery Newcomer wrote:
nice tip, but adding extern doesn't change link behavior at all.
Hmm, are you linking with the DLL (the import library) ? In not, you
need to use dlopen, or what the
Is it in Bugzilla?
Bye,
bearophile
Thanks. I had assumed my interpretation was incorrect and was just looking
for an explanation. Honestly, until just now, I have not explored bugzilla.
There is bug 1141 which looks like what I'm asking about and references a
newer one 2830 which looks
solved. its associated with access private for _data field.
if I use alias compiler must replace call a (for my type) to
a._data if it needs...
On Thursday, 18 October 2012 at 11:31:47 UTC, tn wrote:
Hi.
I want to extend math library functions to work with my own
type. However, the definition for my own type seems to prevent
automated access to the original function. How can I fix this
unexpected behavior?
Simplified example:
On Monday, 15 October 2012 at 20:35:34 UTC, Tyler Jameson Little
wrote:
I'm basically trying to reproduce other JSON marshallers, like
Go's, but using compile-time reflection. Go uses runtime
reflection, which D notably does not support. I like the idea
of compile-time reflection better
On 10/17/2012 11:41 PM, Jacob Carlborg wrote:
On 2012-10-18 05:12, Ellery Newcomer wrote:
nice tip, but adding extern doesn't change link behavior at all.
Hmm, are you linking with the DLL (the import library) ? In not, you
need to use dlopen, or what the corresponding Windows function is.
On Thursday, 18 October 2012 at 11:43:40 UTC, simendsjo wrote:
On Thursday, 18 October 2012 at 11:31:47 UTC, tn wrote:
Hi.
I want to extend math library functions to work with my own
type. However, the definition for my own type seems to prevent
automated access to the original function. How
On Thursday, 18 October 2012 at 12:10:17 UTC, tn wrote:
On Thursday, 18 October 2012 at 11:43:40 UTC, simendsjo wrote:
On Thursday, 18 October 2012 at 11:31:47 UTC, tn wrote:
(...)
You need to manually add std.math.exp2 to the overload set so
importing external methods doesn't hijack your
On Thursday, 18 October 2012 at 13:35:55 UTC, simendsjo wrote:
On Thursday, 18 October 2012 at 12:10:17 UTC, tn wrote:
On Thursday, 18 October 2012 at 11:43:40 UTC, simendsjo wrote:
On Thursday, 18 October 2012 at 11:31:47 UTC, tn wrote:
(...)
You need to manually add std.math.exp2 to the
simendsjo:
I don't think you can overload template methods with
non-template methods:
But maybe this will change.
Bye,
bearophile
Hello. How to cast template struct to itself?
struct vec(string S,T=double)
{
T[S.length] data;
auto opCast(string K,E)()
if( S.length == K.length
is( T : E ) )
{
vec!(K,E) ret;
foreach( i, ref m; ret.data )
m = data[i];
Sorry. My problem more complex and my simplification is not
correct.
I want use mixin for math operations.
mixin template vectOp( string DataName, int DataLen, T, vecType )
{
mixin( alias ~ DataName ~ this; );
auto opBinary(string op,E)( E[DataLen] b )
auto
On Thursday, 18 October 2012 at 06:30:08 UTC, Joshua Niehus wrote:
Is the following snippet a bug?
---
import core.thread;
import std.stdio, std.concurrency;
void foo(Tid tid) {
send(tid, true);
}
void main() {
auto fooTid = spawn(foo, thisTid);
auto receiveInt =
On 10/17/2012 11:29 PM, Joshua Niehus wrote:
Is the following snippet a bug?
---
import core.thread;
import std.stdio, std.concurrency;
void foo(Tid tid) {
send(tid, true);
}
void main() {
auto fooTid = spawn(foo, thisTid);
auto receiveInt = receiveTimeout(dur!seconds(10), (int isInt) {
On 10/17/2012 07:46 PM, drpepper wrote:
I want the function below to run independently -- like a unix
background process, without delaying subsequent code in main. I
tried the following using std.parallelism:
void main() {
function_a(int a, int b) {
...
}
auto new_task = task!function_a(11,
On Thu, Oct 18, 2012 at 11:12 AM, Jeremy DeHaan
dehaan.jerem...@gmail.com wrote:
On Thursday, 18 October 2012 at 08:12:42 UTC, Jonathan M Davis wrote:
On Thursday, October 18, 2012 10:09:46 Jeremy DeHaan wrote:
Is there any kind of work around for this functionality?
The package access
On 2012-10-18, 17:45, Oleg wrote:
Sorry. My problem more complex and my simplification is not correct.
I want use mixin for math operations.
mixin template vectOp( string DataName, int DataLen, T, vecType )
{
mixin( alias ~ DataName ~ this; );
auto opBinary(string op,E)(
On Oct 17, 2012, at 11:29 PM, Joshua Niehus jm.nie...@gmail.com wrote:
Is the following snippet a bug?
---
import core.thread;
import std.stdio, std.concurrency;
void foo(Tid tid) {
send(tid, true);
}
void main() {
auto fooTid = spawn(foo, thisTid);
auto receiveInt =
On Thursday, 18 October 2012 at 18:31:09 UTC, Sean Kelly wrote:
On Oct 17, 2012, at 11:29 PM, Joshua Niehus
void foo(Tid tid) {
send(tid, true);
}
/* snip */
spawn() shouldn't allow you to spawn a delegate. Last I
checked (which was admittedly a while ago), there were some
compiler
On 2012-10-18 13:55, Ellery Newcomer wrote:
I am using python27_digitalmars.lib, which is generated from
libs\python27.lib with coffimplib, and it is linking my executables with
python.dll.
Ok. Do you know how the corresponding C code would look like? Maybe you
need to use the export
On 2012-10-18 15:35, simendsjo wrote:
I don't think you can overload template methods with non-template methods
You cannot. The usual workaround for this is to make the non-template
method a dummy template:
void foo () (int a) {} // Note the extra pair of empty parentheses
But this won't
On 2012-10-18 19:57, Philippe Sigaud wrote:
Does it work? I thought it was not implemented.
Define work. They're not virtual, which this would imply:
All non-static non-private non-template member functions are virtual.
http://dlang.org/function.html#virtual-functions
--
/Jacob Carlborg
On Oct 18, 2012, at 11:35 AM, cal callumena...@gmail.com wrote:
On Thursday, 18 October 2012 at 18:31:09 UTC, Sean Kelly wrote:
On Oct 17, 2012, at 11:29 PM, Joshua Niehus
void foo(Tid tid) {
send(tid, true);
}
/* snip */
spawn() shouldn't allow you to spawn a delegate. Last I checked
On Thursday, 18 October 2012 at 17:33:04 UTC, cal wrote:
I can't see the bug? The receiver accepts a bool as an int,
same way a normal function does. The timeout is long enough
that foo gets a chance to send. If you want to stop the int
receiver getting a bool, you could add another receiver
On Thursday, October 18, 2012 16:22:17 bearophile wrote:
simendsjo:
I don't think you can overload template methods with
non-template methods:
But maybe this will change.
It's bug (I forget the exact bug number). TDPL says that you can do it, and as
I understand it, it's simply a
On Thursday, October 18, 2012 20:42:08 Jacob Carlborg wrote:
On 2012-10-18 19:57, Philippe Sigaud wrote:
Does it work? I thought it was not implemented.
Define work. They're not virtual, which this would imply:
All non-static non-private non-template member functions are virtual.
Does it work? I thought it was not implemented.
Hmm. I don't know what it's current state is. There _is_ a long-standing bug
on it in bugzilla ( http://d.puremagic.com/issues/show_bug.cgi?id=143 ) which
is still open. I had forgotten about it. But the bug is that package doesn't
restrict when
On Thursday, 18 October 2012 at 18:12:49 UTC, Simen Kjaeraas
wrote:
I see you have opOpBinary there - should those be opOpAssign?
Probably. It's an easy mistake to make. Maybe the compiler
should issue a warning when opAssign attempts and fails and
opOpBinary is defined.
Era Scarecrow:
It's an easy mistake to make. Maybe the compiler should issue a
warning when opAssign attempts and fails and opOpBinary is
defined.
If you have strong feelings about this, then add a Bugzilla entry.
There are other cases. Generally the D compiler should add some
warnings
On 10/18/2012 11:45 PM, bearophile wrote:
Era Scarecrow:
It's an easy mistake to make. Maybe the compiler should issue a
warning when opAssign attempts and fails and opOpBinary is defined.
This would have to be implemented very carefully. There are enough
hard to reproduce symbol
On Thursday, 18 October 2012 at 22:07:55 UTC, Timon Gehr wrote:
On 10/18/2012 11:45 PM, bearophile wrote:
There are other cases. Generally the D compiler should add
some warnings that help against operator overloading mistakes.
I don't think that operator overloading gives rise to distinct
Era Scarecrow:
Maybe.. A general warning when something starts with
'op(Op)?[A-Z]' but doesn't actually qualify as any of the
override-able operators? That seems sensible...
Regarding operator overloading there are several situations worth
warning the programmer of. The D compilers should
On 10/19/2012 01:05 AM, Era Scarecrow wrote:
On Thursday, 18 October 2012 at 22:07:55 UTC, Timon Gehr wrote:
On 10/18/2012 11:45 PM, bearophile wrote:
There are other cases. Generally the D compiler should add some
warnings that help against operator overloading mistakes.
I don't think that
On 10/19/2012 01:23 AM, bearophile wrote:
Era Scarecrow:
Maybe.. A general warning when something starts with 'op(Op)?[A-Z]'
but doesn't actually qualify as any of the override-able operators?
That seems sensible...
Regarding operator overloading there are several situations worth
warning
Timon Gehr:
What situations?
This thread has already shown two possible cases worth discussing
about.
This report shows two more cases:
http://d.puremagic.com/issues/show_bug.cgi?id=8844
Two more cases:
Foo opBinary(string op=/\)(Foo f) {}
Foo opBinary(string op)(Foo f) if (op == @) {}
On 10/19/2012 02:12 AM, bearophile wrote:
Timon Gehr:
What situations?
This thread has already shown two possible cases worth discussing about.
This report shows two more cases:
http://d.puremagic.com/issues/show_bug.cgi?id=8844
How is that bug-prone? Are there keyboards where : and =
On 10/18/2012 11:36 AM, Jacob Carlborg wrote:
On 2012-10-18 13:55, Ellery Newcomer wrote:
I am using python27_digitalmars.lib, which is generated from
libs\python27.lib with coffimplib, and it is linking my executables with
python.dll.
Ok. Do you know how the corresponding C code would look
Thank you Ali,
Indeed, I originally had the function outside of main.
I have found another strange result with std.concurrency:
spawn(function, array[0].length, array.length);
// generates compiling error: cannot deduce template function
from arg types
//Yet,
int var_one = array[0].length;
On 10/18/2012 06:34 PM, drpepper wrote:
Thank you Ali,
Indeed, I originally had the function outside of main.
I have found another strange result with std.concurrency:
spawn(function, array[0].length, array.length);
// generates compiling error: cannot deduce template function
from arg
On Thursday, 18 October 2012 at 20:44:42 UTC, Jonathan M Davis
wrote:
Does it work? I thought it was not implemented.
Hmm. I don't know what it's current state is. There _is_ a
long-standing bug
on it in bugzilla (
http://d.puremagic.com/issues/show_bug.cgi?id=143 ) which
is still open. I
Thank you guys. I can't believe that haven't thought of that.
I still feel that this is rather odd though. I would expect to be
able to use UFCS in the scope that imports those libraries.
Though I can definitely see how that might lead to obscure bugs.
On Tuesday, 16 October 2012 at 17:07:36
Hello,
I have been playing around with templated range. I am not quite
sure why the following code does not work:
template isIntLike(T) {
enum isIntLike = is(typeof({
T t = 0;
t = t+t;
// More if needed
}));
}
auto fib(T =
On Friday, October 19, 2012 05:44:10 Michael wrote:
Hello,
I have been playing around with templated range. I am not quite
sure why the following code does not work:
template isIntLike(T) {
enum isIntLike = is(typeof({
T t = 0;
t = t+t;
On Thursday, October 18, 2012 20:55:12 Ali Çehreli wrote:
Explicit conversion works:
return Fib(T(0), T(1));
Except that that won't work for int or other built-in types, because they lack
constructors. What you need is std.conv.to.
- Jonathan M Davis
55 matches
Mail list logo