Sorry about the possible double post. I cannot see my previous..
struct S {
@property int B() {
return 1;
}
}
void main() {
S s1;
auto a1 = s1.B; // ok
const(S) s2;
auto a2 = s2.B; // Error: function t.S.B () is not callable using
argument types ()
}
Information about overloading opIn and opIn_r is missing from the
docs, so I'm writing that section. But I don't know what is the formal
name of this operator so I can put it in the title. Maybe I should
just name the title "Overloading the In Operator"?
On 9/24/11, simendsjo wrote:
> struct S {
> @property int B() {
> return 1;
> }
> }
I've reported the error message just recently because it's very
uninformative. But the solution is to add const to your property
function:
struct S {
@property int B() const {
ret
Oh wait, I've just realized that opIn is actually the old way of using
that operator. The new way is using opBinary and string matching
instead. This is already described in the docs.
I guess opIn and opIn_r are going away?
I think I understand the concept of a template, the declaration of a
class that you never actually have to create, right?
But I am hazy on the difference between sructs and classes, and can't
seem to get a clear understanding from the website.
--
Alex Herrmann
PC load letter
On 2011-09-24 20:59, alex wrote:
I think I understand the concept of a template, the declaration of a
class that you never actually have to create, right?
But I am hazy on the difference between sructs and classes, and can't
seem to get a clear understanding from the website.
Classes are alway
On Saturday, September 24, 2011 20:19:43 Andrej Mitrovic wrote:
> On 9/24/11, simendsjo wrote:
> > struct S {
> >
> > @property int B() {
> >
> > return 1;
> >
> > }
> >
> > }
>
> I've reported the error message just recently because it's very
> uninformative. But
On Saturday, September 24, 2011 20:37:45 Andrej Mitrovic wrote:
> Oh wait, I've just realized that opIn is actually the old way of using
> that operator. The new way is using opBinary and string matching
> instead. This is already described in the docs.
>
> I guess opIn and opIn_r are going away?
How would a specialize a parameterized class to only allow integral
parameters (i.e., anything that would respond "true" to
static if (is (T : long) )
(I'd have said "static if (is (T : cent) )" or "static if (is (T :
ucent) )", but those are still marked "reserved for future use".)
I do want
On Saturday, September 24, 2011 14:16:12 Charles Hixson wrote:
> How would a specialize a parameterized class to only allow integral
> parameters (i.e., anything that would respond "true" to
> static if (is (T : long) )
>
> (I'd have said "static if (is (T : cent) )" or "static if (is (T :
> ucent
I'm guessing the following is an accepts-invalid bug:
void test(int) {}
void main() { test = 4; }
Anyway, if/when the above stops being legal I'd be nice if I could
create property functions using aliases. Something like this:
struct Bar
{
int getFoo() { return 0; }
void setFoo(int i) {
import std.typetuple;
import std.typecons;
struct Foo
{
void test(int x, double y) { }
void opOpAssign(string op, T...)(T t)
if (op == "~")
{
test(t);
}
}
void main()
{
Foo foo;
foo.opOpAssign!"~"(4, 5.0); // ok
foo ~= tuple(4, 5.0); // fail
}
If I
On Sunday, September 25, 2011 00:00:33 Andrej Mitrovic wrote:
> I'm guessing the following is an accepts-invalid bug:
>
> void test(int) {}
> void main() { test = 4; }
>
> Anyway, if/when the above stops being legal I'd be nice if I could
> create property functions using aliases. Something like
On Sunday, September 25, 2011 00:23:18 Andrej Mitrovic wrote:
> import std.typetuple;
> import std.typecons;
>
> struct Foo
> {
> void test(int x, double y) { }
>
> void opOpAssign(string op, T...)(T t)
> if (op == "~")
> {
> test(t);
> }
> }
>
> void main()
> {
>
Has anyone here succeeded with a dmd2.055 one-click install to Linux amd64?
Unlike the prior dmd2.0xx, I have no luck with dmd2.055 for amd64 installs.
I've
tried Debian, Fedora, and Suse.
After some command line work (based on
http://www.d-programming-language.org/dmd-
linux.html), it appeare
On 09/24/2011 02:33 PM, Jonathan M Davis wrote:
On Saturday, September 24, 2011 14:16:12 Charles Hixson wrote:
How would a specialize a parameterized class to only allow integral
parameters (i.e., anything that would respond "true" to
static if (is (T : long) )
(I'd have said "static if (is (T
On Saturday, September 24, 2011 16:14:48 Charles Hixson wrote:
> On 09/24/2011 02:33 PM, Jonathan M Davis wrote:
> > On Saturday, September 24, 2011 14:16:12 Charles Hixson wrote:
> >> How would a specialize a parameterized class to only allow integral
> >> parameters (i.e., anything that would res
If you didn't know, the concurrency chapter of tdpl is a free chapter:
http://www.informit.com/articles/article.aspx?p=1609144
It has an example of file copying with message passing:
http://www.informit.com/articles/article.aspx?p=1609144&seqNum=7
On 09/24/2011 01:18 PM, Andrej Mitrovic wrote:
> Information about overloading opIn and opIn_r is missing from the
> docs, so I'm writing that section. But I don't know what is the formal
> name of this operator so I can put it in the title. Maybe I should
> just name the title "Overloading the In
On 09/24/2011 04:31 PM, Jonathan M Davis wrote:
On Saturday, September 24, 2011 16:14:48 Charles Hixson wrote:
On 09/24/2011 02:33 PM, Jonathan M Davis wrote:
On Saturday, September 24, 2011 14:16:12 Charles Hixson wrote:
How would a specialize a parameterized class to only allow integral
para
On 09/24/2011 04:31 PM, Jonathan M Davis wrote:
On 09/24/2011 04:31 PM, Jonathan M Davis wrote:
On Saturday, September 24, 2011 16:14:48 Charles Hixson wrote:
On 09/24/2011 02:33 PM, Jonathan M Davis wrote:
On Saturday, September 24, 2011 14:16:12 Charles Hixson wrote:
How would a specialize a
On Saturday, September 24, 2011 17:30:36 Charles Hixson wrote:
> OK, here's the problem:
> s$ dmd -unittest test2.d
> /usr/include/d/dmd/phobos/std/traits.d(2576): Error: template
> std.traits.isNumeric(T) is not a function template
> test2.d(8): Error: template std.traits.isNumeric(T) cannot deduc
I spoke too soon.
class AA(Key, Data) if (isNumeric (Key) )
didn't work with a larger case,
s$ dmd aa.d
/usr/include/d/dmd/phobos/std/traits.d(2576): Error: template
std.traits.isNumeric(T) is not a function template
aa.d(200): Error: template std.traits.isNumeric(T) cannot deduce
tem
On Saturday, September 24, 2011 17:41:52 Charles Hixson wrote:
> I spoke too soon.
> class AA(Key, Data) if (isNumeric (Key) )
> didn't work with a larger case,
isNumeric!Key
std.straits.isNumeric is an eponymous template, _not_ a function. I believe
that everything in std.traits is an
On 09/24/2011 05:49 PM, Jonathan M Davis wrote:
On Saturday, September 24, 2011 17:41:52 Charles Hixson wrote:
I spoke too soon.
class AA(Key, Data) if (isNumeric (Key) )
didn't work with a larger case,
isNumeric!Key
std.straits.isNumeric is an eponymous template, _not_ a function
I want to use this in my unittests:
assert(allEqual(Foo(1), obj1, obj2, obj3));
How would you implement a function like allEqual(needle, objects...) ?
Maybe via reduce?
Argh, I've just realized this function would do me no good. I would
get an error on the invocation line but I wouldn't know which of the
objects have compared unequal. Maybe it's best to keep unittest code
really simple.
On Sunday, September 25, 2011 04:16:02 Andrej Mitrovic wrote:
> Maybe it's best to keep unittest code really simple.
That has always been my take on it. Sometimes, you're forced to make it more
complicated, but if your unit tests are complicated, then there's a higher
risk of bugs in them, which
On 9/25/11, Jonathan M Davis wrote:
> On Sunday, September 25, 2011 04:16:02 Andrej Mitrovic wrote:
>> Maybe it's best to keep unittest code really simple.
>
> That has always been my take on it. Sometimes, you're forced to make it more
> complicated, but if your unit tests are complicated, then t
On Sunday, September 25, 2011 04:48:56 Andrej Mitrovic wrote:
> On 9/25/11, Jonathan M Davis wrote:
> > On Sunday, September 25, 2011 04:16:02 Andrej Mitrovic wrote:
> >> Maybe it's best to keep unittest code really simple.
> >
> > That has always been my take on it. Sometimes, you're forced to m
On 9/25/11, Jonathan M Davis wrote:
> -cov
Hehe, forgot about that. That should be perfect with a little script
to filter things out.
"Andrej Mitrovic" wrote in message
news:mailman.142.1316903007.26225.digitalmars-d-le...@puremagic.com...
>
> Is it possible to expand the phobos tuple in the call to test()? I can
> use the isTuple template in a `static if` to figure out if it needs
> expansion, so all that's left is to actually
Jonathan M Davis Wrote:
> On Saturday, September 24, 2011 01:05:52 Jerry Quinn wrote:
> > Jonathan M Davis Wrote:
> > > On Friday, September 23, 2011 23:01:17 Jerry Quinn wrote:
> > >
> > > A direct rewrite would involve using shared and synchronized (either on
> > > the class or a synchronized b
Lutger Blijdestijn Wrote:
> If you didn't know, the concurrency chapter of tdpl is a free chapter:
> http://www.informit.com/articles/article.aspx?p=1609144
>
> It has an example of file copying with message passing:
> http://www.informit.com/articles/article.aspx?p=1609144&seqNum=7
What I rea
On Sunday, September 25, 2011 02:26:18 Jerry Quinn wrote:
> Jonathan M Davis Wrote:
> > On Saturday, September 24, 2011 01:05:52 Jerry Quinn wrote:
> > > Jonathan M Davis Wrote:
> > > > On Friday, September 23, 2011 23:01:17 Jerry Quinn wrote:
> > > >
> > > > A direct rewrite would involve using s
35 matches
Mail list logo