Hi, I'm writing a vec4 math struct and I have a method of which the
return value has to be a lvalue so I wonder which is the correct way to
do this:
vec4 Normalize() const { ... } //won't work, not a lvalue
ref vec4 Normalize() const {
vec4 temp;
...
return temp;
} //will this lead to a
On 07/10/2010 21:32, Stanislav Blinov wrote:
> Steven Schveighoffer wrote:
>
>>> What I'd propose is either:
>>> 1) Create your own lock-free associative array (yup, reinvent the
>>> wheel to introduce AA to the world of 'shared')
>>> 2) In this small case it may seem best (though mind that often
Bob Cowdery wrote:
On 07/10/2010 21:32, Stanislav Blinov wrote:
Steven Schveighoffer wrote:
What I'd propose is either:
1) Create your own lock-free associative array (yup, reinvent the
wheel to introduce AA to the world of 'shared')
2) In this small case it may seem best (though mind that of
Benjamin Thaut wrote:
Hi, I'm writing a vec4 math struct and I have a method of which the
return value has to be a lvalue so I wonder which is the correct way to
do this:
vec4 Normalize() const { ... } //won't work, not a lvalue
ref vec4 Normalize() const {
vec4 temp;
...
return temp;
}
Benjamin Thaut wrote:
Hi, I'm writing a vec4 math struct and I have a method of which the
return value has to be a lvalue so I wonder which is the correct way to
do this:
vec4 Normalize() const { ... } //won't work, not a lvalue
ref vec4 Normalize() const {
vec4 temp;
...
return
On Fri, 08 Oct 2010 09:33:22 +0200, Benjamin Thaut wrote:
> Hi, I'm writing a vec4 math struct and I have a method of which the
> return value has to be a lvalue so I wonder which is the correct way to
> do this:
>
> vec4 Normalize() const { ... } //won't work, not a lvalue
>
> ref vec4 Normalize
Hi,
I'm learning D right now and got a question about property.
I tried to add a property for built-in type like the following
@property bool equalZero(double a) { return a == 0.0; }
void main()
{
...
double x = 4.4;
bool isXZero = x.equalZero;
...
}
but got an error message
main.d(75):
On Fri, 08 Oct 2010 16:19:43 +0400, %u wrote:
Hi,
I'm learning D right now and got a question about property.
I tried to add a property for built-in type like the following
@property bool equalZero(double a) { return a == 0.0; }
void main()
{
...
double x = 4.4;
bool isXZero = x.equalZe
08.10.2010 16:19, %u wrote:
Hi,
I'm learning D right now and got a question about property.
I tried to add a property for built-in type like the following
@property bool equalZero(double a) { return a == 0.0; }
void main()
{
...
double x = 4.4;
bool isXZero = x.equalZero;
...
}
bu
Thanks for the reply.
I wonder are there any alternatives to achieve similar things for built-in
types?
I think this is very helpful for template function for built-in types.
Am 08.10.2010 11:13, schrieb Lars T. Kyllingstad:
On Fri, 08 Oct 2010 09:33:22 +0200, Benjamin Thaut wrote:
Hi, I'm writing a vec4 math struct and I have a method of which the
return value has to be a lvalue so I wonder which is the correct way to
do this:
vec4 Normalize() const { ... } //won'
On Fri, 08 Oct 2010 09:26:19 -0400, Benjamin Thaut
wrote:
Am 08.10.2010 11:13, schrieb Lars T. Kyllingstad:
On Fri, 08 Oct 2010 09:33:22 +0200, Benjamin Thaut wrote:
Hi, I'm writing a vec4 math struct and I have a method of which the
return value has to be a lvalue so I wonder which is the
Steven Schveighoffer wrote:
The correct way is to use auto ref as the parameter:
struct vec4
{
...
vec4 Normalize(auto ref const(vec4) param) {...}
}
But AFAIK, this doesn't really work.
It doesn't, no. I'm not even sure it's scheduled for inclusion.
Also, with bugzilla #4843, overl
On Fri, 08 Oct 2010 09:51:59 -0400, Simen kjaeraas
wrote:
Steven Schveighoffer wrote:
The correct way is to use auto ref as the parameter:
struct vec4
{
...
vec4 Normalize(auto ref const(vec4) param) {...}
}
But AFAIK, this doesn't really work.
It doesn't, no. I'm not even sure
/The following binary expressions are evaluated in an implementation-defined
order:
AssignExpression/../AddExpression/
/It is an error to depend on order of evaluation when it is not specified./
That makes this an error!?
y = x + 1;
Am I being paranoid or should I be adding more brackets?
Lars T. Kyllingstad wrote:
> On Tue, 05 Oct 2010 23:25:36 +0200, vano wrote:
>
>> The code below:
>> module used;
>>
>> import std.stdio;
>>
>> class ClassA {
>> this() { writeln("A ctor"); }
>> ~this() { writeln("A dtor"); }
>> }
>>
>> static this()
%u:
> That makes this an error!?
>
> y = x + 1;
>
> Am I being paranoid or should I be adding more brackets?
I presume this doesn't need other brackets.
And Walter has two or three times stated that he wants to eventually define the
order of evaluation in D (as C#/Java), I hope this will happe
On Fri, 08 Oct 2010 18:49:36 +0400, %u wrote:
/The following binary expressions are evaluated in an
implementation-defined
order:
AssignExpression/../AddExpression/
/It is an error to depend on order of evaluation when it is not
specified./
That makes this an error!?
y = x + 1;
Am I be
== Quote from Denis Koroskin (2kor...@gmail.com)'s article
> On Fri, 08 Oct 2010 18:49:36 +0400, %u wrote:
> > /The following binary expressions are evaluated in an
> > implementation-defined
> > order:
> > AssignExpression/../AddExpression/
> >
> > /It is an error to depend on order of evaluation
I've been running into a few problems with regular expressions in D. One
of the issues I've had recently is matching strings with non ascii
characters. As an example:
auto re = regex( `(.*)\.txt`, "i" );
re.printProgram();
auto m = match( "bà.txt", re );
writefln( "'%s'", m.capture
More of an English question...
dunno <- don't know
ditto <- ?
--
Tomek
On Friday, October 08, 2010 14:13:36 petevi...@yahoo.com.au wrote:
> I've been running into a few problems with regular expressions in D. One
> of the issues I've had recently is matching strings with non ascii
> characters. As an example:
>
> auto re = regex( `(.*)\.txt`, "i" );
> re.prin
On Fri, 08 Oct 2010 16:22:33 -0500, Tomek Sowiński wrote:
More of an English question...
dunno <- don't know
ditto <- ?
http://en.wiktionary.org/wiki/ditto
ditto (plural dittos)
1. That which was stated before, the aforesaid, the above, the same.
2. (informal) A duplicate or copy of a docume
On Friday, October 08, 2010 14:22:33 Tomek Sowiński wrote:
> More of an English question...
> dunno <- don't know
> ditto <- ?
It's a word in and of itself, not the shortening or butchering of another word.
According to merriam-webster.com ( http://www.merriam-
webster.com/dictionary/ditto ), it
Jonathan M Davis:
> It's the past participle of the Italian word dire (to say)
It was, a long time ago. Today it's "detto".
Bye,
bearophile
On Sat, 09 Oct 2010 01:22:33 +0400, Tomek Sowiński wrote:
More of an English question...
dunno <- don't know
ditto <- ?
Ditto is used to indicate that something already said is applicable a
second time.
In documentation, "ditto" means that previous comment also applies here.
Here is an e
On Friday, October 08, 2010 15:17:13 bearophile wrote:
> Jonathan M Davis:
> > It's the past participle of the Italian word dire (to say)
>
> It was, a long time ago. Today it's "detto".
>
> Bye,
> bearophile
Good to know. I was just going by what Merriam Webster had to say on that one.
I
know
This is a simple D2 class that uses Contracts:
import std.c.stdio: printf;
class Car {
int speed = 0;
invariant() {
printf("Car invariant: %d\n", speed);
assert(speed >= 0);
}
this() {
printf("Car constructor: %d\n", speed);
speed = 0;
}
On Friday 08 October 2010 20:16:10 bearophile wrote:
> This is a simple D2 class that uses Contracts:
>
>
> import std.c.stdio: printf;
>
> class Car {
> int speed = 0;
>
> invariant() {
> printf("Car invariant: %d\n", speed);
> assert(speed >= 0);
> }
>
> this(
29 matches
Mail list logo