On Monday, 24 June 2013 at 05:31:29 UTC, Ali Çehreli wrote:
On 06/23/2013 10:07 PM, Ali Çehreli wrote:
> I think it is a compiler bug.
Make that a Phobos bug. :)
The following is a reduced program that exhibits the problem.
The presence or absence of the unused member function makes a
differ
On 06/23/2013 10:07 PM, Ali Çehreli wrote:
> I think it is a compiler bug.
Make that a Phobos bug. :)
The following is a reduced program that exhibits the problem. The
presence or absence of the unused member function makes a difference:
import std.typecons;
struct S
{
int x;
// Bi
On 06/23/2013 09:40 PM, Anthony Goins wrote:
> On Monday, 24 June 2013 at 01:22:12 UTC, cal wrote:
>> Tuple!(S) foo() { return tuple(this); }
> import std.stdio, std.typecons;
>
> struct S
> {
> int x;
> int y;
> int z;
>
> auto foo() { return tuple(this.tupleof); }
> }
On Saturday, 22 June 2013 at 21:27:01 UTC, bearophile wrote:
Ali Çehreli:
The code compiles under 32-bit (e.g. with the -m32 compiler
switch) where size_t is an alias of uint.
Thanks, Ali! I'm always compiling on 64 bit systems; I'll add the
32 bit switch to my diagnostic approach now.
Oh
On Monday, 24 June 2013 at 01:22:12 UTC, cal wrote:
What is going on here?
import std.stdio, std.typecons;
struct S
{
int x;
Tuple!(S) foo() { return tuple(this); }
}
void main()
{
S s;
s.x = 8;
writeln((s.foo())); //output: Tuple!(S)(S(8))
writeln((s.foo())[0]); /
What is going on here?
import std.stdio, std.typecons;
struct S
{
int x;
Tuple!(S) foo() { return tuple(this); }
}
void main()
{
S s;
s.x = 8;
writeln((s.foo())); //output: Tuple!(S)(S(8))
writeln((s.foo())[0]); //output: S(0)
}
Jonathan M Davis:
The way that you normally indicate exclusive and inclusive
intervals in math
is ) vs ], where ) is exclusive and ] is inclusive. Some folks
will understand
that. I don't think that anyone will understand that ... says
anything about
whether the end is inclusive or exclusive -
On Sunday, June 23, 2013 16:20:51 bearophile wrote:
> It uses 3 dots because it's an interval that includes the right
> end.
The way that you normally indicate exclusive and inclusive intervals in math
is ) vs ], where ) is exclusive and ] is inclusive. Some folks will understand
that. I don't t
On Sunday, June 23, 2013 13:35:55 monarch_dodra wrote:
> On Sunday, 23 June 2013 at 10:59:06 UTC, Jonathan M Davis wrote:
> > On Sunday, June 23, 2013 12:48:15 monarch_dodra wrote:
> >> C++ doesn't allow it. I don't know about the rest.
> >
> > Yes it does.
> >
> > - Jonathan M Davis
>
> Oh. Wow
Adam D. Ruppe:
code:
http://arsdnet.net/dcode/rpc-example.d
library:
https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff/blob/master/rpc.d
It's online:
http://rosettacode.org/wiki/Distributed_programming#D
Bye,
bearophile
On 2013-06-23 17:29, Lemonfiend wrote:
Using the .classinfo is what I looked at before asking here.
However, according to the specs:
".classinfo applied to an interface gives the information for the
interface, not the class it might be an instance of."
So the i.classinfo and B.classinfo would be
On Sunday, 23 June 2013 at 15:15:16 UTC, Jacob Carlborg wrote:
On 2013-06-23 13:26, Lemonfiend wrote:
foreach (I i; array) {
if (B b = cast(B) i) { ... }
}
Thanks all 3 of you for the quick and identical answers. :)
It had not occurred to me to use a cast for this, but indeed
the
languag
On 2013-06-23 13:26, Lemonfiend wrote:
foreach (I i; array) {
if (B b = cast(B) i) { ... }
}
Thanks all 3 of you for the quick and identical answers. :)
It had not occurred to me to use a cast for this, but indeed the
language ref says the same:
"In order to determine if an object o is an
On 2013-06-23 13:27, Timon Gehr wrote:
Example?
@(3) int a;
alias Tuple!(__traits(getAttributes, mixin("a"))) attrs;
--
/Jacob Carlborg
On 2013-06-23 12:04, Jonathan M Davis wrote:
I would have thought that that was obvious, and I fail to see why that would
be a problem. The only risk I see in allowing static and non-static functions
to be overloaded, is that if you have static function being called with an
instance, and you add
I am thinking about opening an enhancement request, but this time
I first prefer to ask your opinion here.
For this code:
void main() {
ubyte x;
ubyte y = x << 1;
}
The range analysis determines that it's conceivable to the result
of that expression to not fit in y, so the D compiler
Is this code available in any repo/archive somewhere?
/Per
On 06/23/13 13:23, Timon Gehr wrote:
> On 06/23/2013 12:19 PM, Artur Skawina wrote:
>> On 06/22/13 21:52, Timothee Cour wrote:
>>> Is there a reason the language spec disallows this?
>>>
>>>
>>> void main(){
>>> auto a=mixin("1");//OK
>>> alias b=a;//OK
>>> mixin("alias c=a;");//OK
Am 23.06.2013 11:47, schrieb Michal Minich:
> Does anybody know some good looking or with good features?
>
> btw, I'm wondering why is some basic version of Candy Doc bundled with DMD.
>
> Thanks.
There is cuteDoc: https://github.com/JakobOvrum/cuteDoc - But it seems
like Robik deleted his repo.
On Sunday, 23 June 2013 at 10:59:06 UTC, Jonathan M Davis wrote:
On Sunday, June 23, 2013 12:48:15 monarch_dodra wrote:
C++ doesn't allow it. I don't know about the rest.
Yes it does.
- Jonathan M Davis
Oh. Wow. That's news to me actually. I thought I new everything
about C++ ^^
On 06/23/2013 01:26 PM, Lemonfiend wrote:
foreach (I i; array) {
if (B b = cast(B) i) { ... }
}
Thanks all 3 of you for the quick and identical answers. :)
It had not occurred to me to use a cast for this, but indeed the
language ref says the same:
"In order to determine if an object o is
On 06/23/2013 11:32 AM, Jacob Carlborg wrote:
On 2013-06-22 23:47, Timon Gehr wrote:
No, it is arbitrary.
I think the spec says you can only mixin whole expression.
That only means you cannot do things like eg:
mixin("a*"); mixin("b");
but instead you need to do:
mixin("a*b");
such that
foreach (I i; array) {
if (B b = cast(B) i) { ... }
}
Thanks all 3 of you for the quick and identical answers. :)
It had not occurred to me to use a cast for this, but indeed the
language ref says the same:
"In order to determine if an object o is an instance of a class B
use a cast"
It
On 06/23/2013 12:19 PM, Artur Skawina wrote:
On 06/22/13 21:52, Timothee Cour wrote:
Is there a reason the language spec disallows this?
void main(){
auto a=mixin("1");//OK
alias b=a;//OK
mixin("alias c=a;");//OK
// alias c=mixin("a");//NG : Error: basic type expected, not
On Sunday, 23 June 2013 at 11:04:59 UTC, Lemonfiend wrote:
I'm trying to create a fairly generic component system, where
an object iterates over a bunch of other objects that all
implement a certain interface.
And this all works fine, however, I would also like to be able
to get objects of a sp
On Sunday, 23 June 2013 at 11:04:59 UTC, Lemonfiend wrote:
...
void writeAll()
{
foreach(elem; array)
elem.write();
}
void writeB()
{
// Only call .write on B's
// How do I get the B's
On 06/23/13 13:04, Lemonfiend wrote:
> void writeAll()
> {
> foreach(elem; array)
> elem.write();
> }
>
> void writeB()
> {
> // Only call .write on B's
> // How do I get the B's from the array of I's?
> }
void writeB()
{
I'm trying to create a fairly generic component system, where an
object iterates over a bunch of other objects that all implement
a certain interface.
And this all works fine, however, I would also like to be able to
get objects of a specific type (a la instanceOf), and I can't
figure out how t
On Sunday, June 23, 2013 12:48:15 monarch_dodra wrote:
> C++ doesn't allow it. I don't know about the rest.
Yes it does. I just tested it. This code compiles and runs just fine
#include
using namespace std;
class C
{
public:
static void foo()
{
cout << "I'm static!" << endl;
On Sunday, 23 June 2013 at 10:09:39 UTC, Jonathan M Davis wrote:
On Sunday, June 23, 2013 12:02:42 Namespace wrote:
> I don't see what's so terrible about it
It's bug prone.
class Foo {
public:
static void test1() { }
void test2() { }
}
Foo f;
f.test1(); /// Oh nice, that work
On 06/22/13 21:52, Timothee Cour wrote:
> Is there a reason the language spec disallows this?
>
>
> void main(){
> auto a=mixin("1");//OK
> alias b=a;//OK
> mixin("alias c=a;");//OK
> // alias c=mixin("a");//NG : Error: basic type expected, not mixin
> }
How would that be different from "aut
On Sunday, June 23, 2013 12:02:42 Namespace wrote:
> > I don't see what's so terrible about it
>
> It's bug prone.
>
> class Foo {
> public:
> static void test1() { }
> void test2() { }
> }
>
> Foo f;
> f.test1(); /// Oh nice, that works, f is not null.
> f.test2(); /// WTF? f is nul
I don't see what's so terrible about it
It's bug prone.
class Foo {
public:
static void test1() { }
void test2() { }
}
Foo f;
f.test1(); /// Oh nice, that works, f is not null.
f.test2(); /// WTF? f is null?
Also I don't know why I should call static methods from an
instance.
On Sunday, June 23, 2013 11:30:11 Jacob Carlborg wrote:
> On 2013-06-22 23:51, Timon Gehr wrote:
> > If that is the only problem then the solution is to allow overloading on
> > static, which is easy to do.
>
> You still need to call the static method on the class/struct if there's
> an ambiguity.
Does anybody know some good looking or with good features?
btw, I'm wondering why is some basic version of Candy Doc bundled
with DMD.
Thanks.
On 2013-06-22 23:51, Timon Gehr wrote:
If that is the only problem then the solution is to allow overloading on
static, which is easy to do.
You still need to call the static method on the class/struct if there's
an ambiguity.
--
/Jacob Carlborg
On 2013-06-22 23:47, Timon Gehr wrote:
No, it is arbitrary.
I think the spec says you can only mixin whole expression. But for some
reason you can use a mixin in a __traits expression without having the
whole expression in a mixin.
--
/Jacob Carlborg
37 matches
Mail list logo