On 03/19/2012 04:40 AM, H. S. Teoh wrote:
OK, perhaps the previous subject line of the previous post deterred
people from actually reading the contents. :-(
Basically, I'm trying to address Andrei's request that this should work
with my AA implementation:
int[dstring] aa;
OK, perhaps the previous subject line of the previous post deterred
people from actually reading the contents. :-(
Basically, I'm trying to address Andrei's request that this should work
with my AA implementation:
int[dstring] aa;
aa[abc] = 1; // abc implicitly deduced as
On 19 March 2012 16:40, H. S. Teoh hst...@quickfur.ath.cx wrote:
OK, perhaps the previous subject line of the previous post deterred
people from actually reading the contents. :-(
Basically, I'm trying to address Andrei's request that this should work
with my AA implementation:
On Wed, Mar 14, 2012 at 02:07:04PM -0500, Andrei Alexandrescu wrote:
[...]
Aha! This is one of those cases in which built-in magic smells of
putrid beef soup.
[...]
It gets worse than we first thought:
void f1(dstring x) { dstring y = x; }
void f2()(dstring x) { dstring y = x;
Code:
import std.stdio;
version(explicit) {
void func(dstring s) {
dstring t = s;
writeln(t);
}
} else {
void func(S)(S s) {
dstring t = s; // line 10
On 14-03-2012 19:00, H. S. Teoh wrote:
Code:
import std.stdio;
version(explicit) {
void func(dstring s) {
dstring t = s;
writeln(t);
}
} else {
void func(S)(S s) {
On 14-03-2012 19:00, Alex Rønne Petersen wrote:
On 14-03-2012 19:00, H. S. Teoh wrote:
Code:
import std.stdio;
version(explicit) {
void func(dstring s) {
dstring t = s;
writeln(t);
}
} else {
void func(S)(S s) {
dstring t = s; // line 10
writeln(t);
}
}
void main() {
func(abc);
}
If
On Wed, Mar 14, 2012 at 07:00:35PM +0100, Alex Rønne Petersen wrote:
On 14-03-2012 19:00, H. S. Teoh wrote:
Code:
import std.stdio;
version(explicit) {
void func(dstring s) {
dstring t = s;
writeln(t);
}
}
On 14-03-2012 19:16, H. S. Teoh wrote:
On Wed, Mar 14, 2012 at 07:00:35PM +0100, Alex Rønne Petersen wrote:
On 14-03-2012 19:00, H. S. Teoh wrote:
Code:
import std.stdio;
version(explicit) {
void func(dstring s) {
dstring t = s;
On 14.03.2012 22:00, H. S. Teoh wrote:
Code:
import std.stdio;
version(explicit) {
void func(dstring s) {
dstring t = s;
writeln(t);
}
} else {
void func(S)(S s) {
Alex Rønne Petersen xtzgzo...@gmail.com wrote in message
news:jjqn9f$1iht$1...@digitalmars.com...
But then... why not just make it take a dstring? Maybe I'm not following
your intent here...
Probably because then this becomes an error:
string s = abc;
func(s);
It's an interesting problem.
Dmitry Olshansky dmitry.o...@gmail.com wrote in message
news:jjqnnj$1j86$1...@digitalmars.com...
How about this (untested)?
void func()(dstring s) {
dstring t = s;
//... funcImpl(t);
}
void func(S)(S s) {
dstring t = to!dstring(s);
//... funcImpl(t);
}
That fails to compile when
On Wed, 14 Mar 2012 14:16:11 -0400, H. S. Teoh hst...@quickfur.ath.cx
wrote:
What I want is to force the compiler to deduce S=dstring when I declare
func(S)(S) and call it as func(abc).
http://d.puremagic.com/issues/show_bug.cgi?id=4998
Please vote or contribute your thoughts.
-Steve
On Wed, Mar 14, 2012 at 02:44:40PM -0400, Steven Schveighoffer wrote:
On Wed, 14 Mar 2012 14:16:11 -0400, H. S. Teoh
hst...@quickfur.ath.cx wrote:
What I want is to force the compiler to deduce S=dstring when I
declare func(S)(S) and call it as func(abc).
On 3/14/12 2:01 PM, H. S. Teoh wrote:
However, this change broke this code:
AssociativeArray!(wstring,int) aa;
aa[abc] = 123; // error: compiler deduces K as string,
// so isCompatWithKey!K fails: string
//
On Wed, Mar 14, 2012 at 02:07:04PM -0500, Andrei Alexandrescu wrote:
On 3/14/12 2:01 PM, H. S. Teoh wrote:
However, this change broke this code:
AssociativeArray!(wstring,int) aa;
aa[abc] = 123;// error: compiler deduces K as string,
// so
On Wed, Mar 14, 2012 at 02:07:04PM -0500, Andrei Alexandrescu wrote:
On 3/14/12 2:01 PM, H. S. Teoh wrote:
However, this change broke this code:
AssociativeArray!(wstring,int) aa;
aa[abc] = 123;// error: compiler deduces K as string,
// so
On 3/14/12 2:34 PM, H. S. Teoh wrote:
I tried the following, but it still doesn't work properly:
void opIndexAssign()(in Value v, in Key key)
{
__opIndexAssignImpl(v, key);
}
void opIndexAssign(K)(in Value v, in K key)
if
On 03/14/2012 08:34 PM, H. S. Teoh wrote:
On Wed, Mar 14, 2012 at 02:07:04PM -0500, Andrei Alexandrescu wrote:
On 3/14/12 2:01 PM, H. S. Teoh wrote:
However, this change broke this code:
AssociativeArray!(wstring,int) aa;
aa[abc] = 123; // error: compiler deduces K as
On 03/14/2012 09:18 PM, Timon Gehr wrote:
Use this for now:
void opIndexAssign(K)(in int v, scope K key)
if (!is(K==Key) isCompatWithKey!K)
{...}
oops.
I meant:
void opIndexAssign(K)(in Value v, scope K key)
if (!is(K==Key) isCompatWithKey!K)
{...}
'in K key'/const(K) key will only
20 matches
Mail list logo