On 2012-10-18 20:51, Philippe Sigaud wrote:
I mean, the 'package' access modifier.
So did I.
class Foo
{
package void foo () {}
}
Would, according to the spec, imply a virtual method. But as Jonathan
said, this is a bug in the spec.
--
/Jacob Carlborg
On 2012-10-19 02:30, Ellery Newcomer wrote:
extern(C) extern export PyTypeObject PyType_Type;
seems to do the trick (I'm using a boiled down case just now)!
High five to the [non-me] non-windows dev!
Hehe, high five :)
--
/Jacob Carlborg
On Thursday, 18 October 2012 at 23:51:44 UTC, Timon Gehr wrote:
If the issue _is_ with the signature, then the compiler should
tell you. That is the (secondary) job of the compiler.
But not everything is parsed/compiled if it doesn't match the
constraints, especially template functions. Somet
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
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;
>
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 = int)(
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 U
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 had
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
>
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 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 l
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 = are
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 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 th
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 o
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 b
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
mi
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 resolution
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 that
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.
> 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, 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.
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 q
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 w
On Oct 18, 2012, at 11:35 AM, cal 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 (which wa
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 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" attrib
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 w
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 issues
On Oct 17, 2012, at 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 = receiveTim
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)( E[
On Thu, Oct 18, 2012 at 11:12 AM, Jeremy DeHaan
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 modifier.
>>
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, 12)
Sorry, wrong thread. :(
Ali
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) {
wri
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 = receiveTimeout(du
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 opBinary(s
On 2012-10-18, 16:54, Oleg wrote:
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.d
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];
retu
simendsjo:
I don't think you can overload template methods with
non-template methods:
But maybe this will change.
Bye,
bearophile
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 overl
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 metho
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 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 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 anyway.
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:
-
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:
import std.math;
int exp2(int x) {
r
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...
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 wh
On Thu, 18 Oct 2012 07:41:16 +0100, 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
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.lengt
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.
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, 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
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 tw
55 matches
Mail list logo