Re: How to partially forward properties of struct array member to struct (disable length property) ?

2015-09-08 Thread Kenji Hara via Digitalmars-d-learn
On Sunday, 6 September 2015 at 10:12:58 UTC, ParticlePeter wrote: In the end all that I want is "just" to disable access to array.length through vector and alias this array. struct Vec(T, size_t n = 3) { T[n] data; alias data this; @disable @property size_t length() const; }

Re: Cannot use the same template arguments on function as the ones on struct

2015-02-12 Thread Kenji Hara via Digitalmars-d-learn
be optional anyway. It would be a compiler bug. As far as I know, accepter() and accepter!()() has no difference in IFTI. I filed the issue in bugzilla. https://issues.dlang.org/show_bug.cgi?id=14174 Kenji Hara

Re: class is forward referenced when looking for 'v'

2015-01-30 Thread Kenji Hara via Digitalmars-d-learn
request to fix compiler. Kenji Hara

Re: Segfault upon modifying immutable AA in static this

2015-01-24 Thread Kenji Hara via Digitalmars-d-learn
of the AAs or can I preserve my convenient foreach over the AAs in the `static this` to automatically get the integer value to be stored? Note that this does not segdefault on latest stable DMD 2.066. It's a regression in git-head. https://issues.dlang.org/show_bug.cgi?id=14038 Kenji Hara

Re: Initialization of structure field w/o default ctor

2015-01-22 Thread Kenji Hara via Digitalmars-d-learn
as a construction for the field Bar.foo. Kenji Hara

Re: Redirect to different overloads at compile time?

2014-06-29 Thread Kenji Hara via Digitalmars-d-learn
a) { writeln(typeof(a).stringof); return a; } float foo_float (float a) { writeln(typeof(a).stringof); return a; } } alias foo = foo_double; alias foo = foo_float; void main() { double d; float f; foo(d); // prints double foo(f); // prints float } Kenji Hara

Re: Don't Understand why Phobos Auto-Tester fails for PR #3606

2014-06-07 Thread Kenji Hara via Digitalmars-d-learn
! I commented in github. Kenji Hara

Re: CTFE error, but I have no idea what it means.

2014-04-03 Thread Kenji Hara
On Monday, 31 March 2014 at 11:51:50 UTC, Olav Lindekleiv wrote: Here's the issue: http://d.puremagic.com/issues/show_bug.cgi?id=12498 Fixed in git-head. https://github.com/D-Programming-Language/dmd/commit/2c4d8ad711ccb7c94d349830523dd500580b0130 Kenji Hara

Re: template interface and delegates

2014-04-02 Thread Kenji Hara
already reported, someone will close it as a duplicate -Steve I filed it. https://d.puremagic.com/issues/show_bug.cgi?id=12508 Kenji Hara

Re: strange compilation error

2014-03-10 Thread Kenji Hara
On Sunday, 9 March 2014 at 11:21:19 UTC, Jack Applegame wrote: This fails to compile http://dpaste.dzfl.pl/e9a90e808af4 It's a compiler bug. https://d.puremagic.com/issues/show_bug.cgi?id=12334 https://github.com/D-Programming-Language/dmd/pull/3371 Kenji Hara

Re: Type inference and overloaded functions

2013-12-12 Thread Kenji Hara
, 5, 6]s) would easily cause memory corruption. I don't want to hurt language future by the trivial syntactic sugar. Kenji Hara

Re: Type inference and overloaded functions

2013-12-10 Thread Kenji Hara
literal should match _only_ dynamic array types, it would never work. Because compiler will try to match array literal to static array T[n]. The feature which I have described is working here. Kenji Hara

Re: Type inference and overloaded functions

2013-12-10 Thread Kenji Hara
code bloat. void foo(T)(T arg) { ... } foo(aaa); // instantiate foo!(char[3]) foo(); // instantiate foo!(char[4]) foo([1,2]);// instantiate foo!(int[2]) foo([1,2,3]); // instantiate foo!(int[3]) So their types were changed to dynamic array by default. Kenji Hara

Re: Type inference and overloaded functions

2013-12-09 Thread Kenji Hara
both to int[] and int[3]. And, int[3] is more specialized than int[], so overload resolution will choose the first 'bar'. Kenji Hara

Re: Template condition triggers compiler error?

2013-12-01 Thread Kenji Hara
on Linux with 64 bit, but it fails on Windows 7 32 bit. Bug, feature or my fault? Compiler bug. https://d.puremagic.com/issues/show_bug.cgi?id=11662 Kenji Hara

Re: alias this leads to compilation error in one of two similar contexts

2013-12-01 Thread Kenji Hara
; // also NG, my_integer cannot *initialize* by int value num = my_interger(n); // OK } } Kenji Hara

Re: Function literal bug?

2013-11-28 Thread Kenji Hara
it has more bugs. Bye, bearophile It's a known front-end issue. https://d.puremagic.com/issues/show_bug.cgi?id=11545 Kenji Hara

Re: casting as char at CT fail

2013-11-27 Thread Kenji Hara
is needed thanks to everyone I found two compiler issues: https://d.puremagic.com/issues/show_bug.cgi?id=11627 https://d.puremagic.com/issues/show_bug.cgi?id=11629 Kenji Hara

Re: pure-ifying my code

2013-11-20 Thread Kenji Hara
, not a compiler dev. - Jonathan M Davis I opened a new pull request to fix the compiler issue. https://github.com/D-Programming-Language/dmd/pull/2832 Kenji Hara

Re: Calling Base Class Overriden Methods

2013-11-18 Thread Kenji Hara
() { auto d = new D(); assert(d.foo() == 3);// calls D.foo assert(d.B.foo() == 1); // calls B.foo assert(d.C.foo() == 2); // calls C.foo d.test(); } = Kenji Hara

Re: dchar literals?

2013-11-12 Thread Kenji Hara
Kenji Hara

Re: Bug in RefCounted?

2013-10-29 Thread Kenji Hara
, but currently it isn't. It's a compiler bug. http://d.puremagic.com/issues/show_bug.cgi?id=11382 Kenji Hara

Re: Templates with alias param instantiated with null cached by DMD..?

2013-10-23 Thread Kenji Hara
the current ABI definition issue (== #2) is a language spec bug or not... Kenji Hara

Re: cannot call impure function ~this

2013-10-17 Thread Kenji Hara
/show_bug.cgi?id=11286 https://github.com/D-Programming-Language/dmd/pull/2677 Kenji Hara

Re: copying const struct

2013-10-14 Thread Kenji Hara
/issues/show_bug.cgi?id=11187 And, a week ago it is fixed. 2.064 beta1 contains the fix. Kenji Hara

Re: Phobos - pure, const, safe, nothrow

2013-10-02 Thread Kenji Hara
attributes of the underlying type's methods. std.typecons.Proxy is designed to work transparently for the underlying method qualifiers. But I also agree that the implementation is still insufficient. Could you show us the not working case? It would be much help. Kenji Hara

Re: Mixin namespace ambiguity?

2013-09-15 Thread Kenji Hara
are treated as if they are just imported at the mixed-in scope. Therefore, even from main.d, the two mixed-in functions 'a' have same closeness, and the call is ambiguous because they have exactly same signature. Kenji Hara

Re: Limited type matching?

2013-09-10 Thread Kenji Hara
to value type, but the behavior was not changed. As far as I know, there was no discussion about that, but at least it is not fundamentally wrong. Kenji Hara And what is your personal opinion? I think an implicit cast between signed / unsigned would be acceptable even with static arrays. It were

Re: Limited type matching?

2013-09-09 Thread Kenji Hara
the behavior was expected. In D2, static array had changed to value type, but the behavior was not changed. As far as I know, there was no discussion about that, but at least it is not fundamentally wrong. Kenji Hara

Re: Struct with opDispatch doesn't dispatch. Is this a bug?

2013-07-05 Thread Kenji Hara
. But UFCS cannot find module level function 's', then compiler reports irrelevant error message no property 's' Kenji Hara

Re: How to determine if a function is implemented

2013-07-05 Thread Kenji Hara
(); } mixin template Foo() { override int foo() { return 1; } } class C1 : I { mixin Foo!(); } class C2 : I { int foo() { return 10; } mixin Foo!(); // mixed-in foo is not stored in vtbl } void main() { assert(new C1().foo() == 1); assert(new C2().foo() == 10); } Kenji

Re: opDispatch and UFCS

2013-07-02 Thread Kenji Hara
!(to) isn't a template } Should the constraint on opDispatch allow the UFCS to call on S? That's a compiler bug. http://d.puremagic.com/issues/show_bug.cgi?id=10526 Kenji Hara

Re: Strange error when importing std.regex

2013-06-13 Thread Kenji Hara
for that, but unfortunately it is not yet merged. https://github.com/D-Programming-Language/dmd/pull/1660 Kenji Hara

Re: Clarification of @trusted attribute?

2013-06-13 Thread Kenji Hara
, time.month, time.day, time.hour, time.minute, time.second); } In this case, format std.string.format function should work under the `safe annotation. I recently worked to make it possible. https://github.com/D-Programming-Language/phobos/pull/1337 Kenji Hara

Re: How to implement this?

2013-06-10 Thread Kenji Hara
, (C, B, A, Object) Kenji Hara

Re: Compiler bug ?

2013-06-09 Thread Kenji Hara
(getAttributes, mixin(`a.` ~ it))); writeln(`passing: `, tp[0]); bar!(tp[0])(); } } Kenji Hara

Re: Is this a compiler bug, or a breaking fix/enhancement?

2013-05-29 Thread Kenji Hara
)) { return cast(T)as!(OriginalType!T); } } void main() { S val = S(-20); assert(val.as!int == -20); assert(val.as!E == E.F); // val.as!E causes a compile time error. } --- This is a compiler regression in 2.063 release. http://d.puremagic.com/issues/show_bug.cgi?id=10197 Kenji

Re: static const and user attribute

2013-05-29 Thread Kenji Hara
On Wednesday, 29 May 2013 at 14:50:36 UTC, bearophile wrote: Dicebot: I think this is a bug. It will be fixed progressively in the next two or three DMD versions. Bye, bearophile Please file it in bugzilla. Kenji Hara

Re: Two questions about assignments

2013-05-27 Thread Kenji Hara
T1 = Tuple!(int, int); alias T2 = Tuple!(int,x, int,y); auto t1 = T1(10, 20); auto t2 = T2(100, 200); t1 = t2; // OK. t2 = t1; // OK? } std.typecons.Tuple supports structural assignment before the change. The code also works with 2.062. Kenji Hara

Re: Two questions about assignments

2013-05-27 Thread Kenji Hara
situations they act in a structural typing way. I think this mix of behaviours is a little confusing. Basically Tuple would follow structural typing. Even if it is impossible, it would follow true subtyping right now. That's the purpose of my change. Kenji Hara

Re: Scoped import bug?

2013-05-09 Thread Kenji Hara
but *not* the runtime assert. Why cant the function Blah.blah() find the array implementation of front? This is a known UFCS name look-up issue. In 2.063dev, the bug is fixed. Please wait the release. Kenji Hara

Re: Template alias parameter does not accept types

2013-05-09 Thread Kenji Hara
of language design. Kenji Hara

Re: Scoped import bug?

2013-05-09 Thread Kenji Hara
On Thursday, 9 May 2013 at 18:25:39 UTC, Mike Linford wrote: On Thursday, 9 May 2013 at 09:52:12 UTC, Kenji Hara wrote: On Thursday, 9 May 2013 at 05:01:15 UTC, Mike Linford wrote: I'm not sure whether or not I've encountered a bug or whether my understanding of scoped imports is just faulty

Re: Using inout in delegate

2013-04-02 Thread Kenji Hara
be rejected statically) } If compiler does not reject escape... void main() { const int[] a = [3, 4, 5]; auto dg = foo(a); // typeof(dg) == inout(int[]) delegate(inout(int[])) int[] b = dg([]); assert(b.ptr == a.ptr); // type-system breaking! } Kenji Hara

Re: isExpression with bool template parameter

2013-03-28 Thread Kenji Hara
, `alias TX` will bind the template Tuple. There is no problem. Kenji Hara

Re: using this instead of typeof(this)

2013-02-26 Thread Kenji Hara
on that. Kenji Hara

Re: Delegate type inferred as pure

2013-01-28 Thread Kenji Hara
On Monday, 28 January 2013 at 03:16:24 UTC, cal wrote: This fails: void main() { int z; typeof((int a){return z;}) dg; dg = (int a) {return z;}; } Error: cannot implicitly convert expression (__lambda2) of type int delegate(int a) nothrow @safe to int delegate(int a) pure nothrow

Re: Need help with storage class definition

2013-01-14 Thread Kenji Hara
', and it is treated as a part of parameter type. 'inout' is also treated as a type qualifier, and then is the same. Kenji Hara

Re: ref return function using foreach ref result segfaults. Compiler bug?

2012-11-13 Thread Kenji Hara
a bug in the compiler to me. What do you guys think? This issue looks like bug8093. http://d.puremagic.com/issues/show_bug.cgi?id=8093 And the code works correctly in git head (dmd2.061alpha). Therefore, I think that the bug is fixed very recently. Kenji Hara

Re: templated static array

2012-10-15 Thread Kenji Hara
this on numerous occasions, and it's among his top thousand wanted features. :p I think this is a bug in IFTE. Please file it into bugzilla. Kenji Hara

Re: offsetof + foreach

2012-09-08 Thread Kenji Hara
, and it's not buffer's field itself. Your code is equivalent with: foreach(i,_; buffer.tupleof) { auto _t = buffer.tupleof[i];// _t is a normal variable writefln(%s@: %s, _t.stringof, _t.offsetof); } Then you cannot get offsetof property from _t; Regards. Kenji Hara

Re: How to create TypeTuple/ExpressionTuple from tuple/tuples

2012-08-08 Thread Kenji Hara
On Tuesday, 7 August 2012 at 16:11:05 UTC, Andrej Mitrovic wrote: On 8/7/12, Øivind oivind@gmail.com wrote: How can I call this function with an already-constructed tuple but pass the pule as an expressiontuple? auto v = tuple(1, 2, 3); f(v); Use the .expand property: f(v.expand) You

Re: template - aliasing a member function

2012-08-08 Thread Kenji Hara
On Wednesday, 8 August 2012 at 23:21:32 UTC, Ellery Newcomer wrote: say I have template T(alias fn) { } class Foo { int i(); void i(int); } alias T!(Foo.i) Biz; Is there a way to get a handle to both of the overloads of Foo.i inside T? Actually, all I really need for that is to get

Re: ~= call copy ctor?

2012-07-21 Thread Kenji Hara
id. Implicit Copy CTor? ;) Array appending and struct postblit behavior is now broken. I've suggested a pull request to fix these bugs. https://github.com/D-Programming-Language/dmd/pull/1037 Bye. Kenji Hara

Re: Literals starting with 0 will not work with UFCS

2012-07-03 Thread Kenji Hara
Kenji Hara

Re: Stack overflow / recursive expansion with alias this

2012-06-27 Thread Kenji Hara
ticket. That's what I do now. Thanks a lot for your help. Today I posted a pull to detect recursive alias this dependency. https://github.com/D-Programming-Language/dmd/pull/1028 Bye. Kenji Hara

Re: Problem about using struct

2012-06-25 Thread Kenji Hara
://d.puremagic.com/issues/show_bug.cgi?id=6036 As far as I know, there is no workaround... Kenji Hara

Re: Retain struct when using alias this and passing using the alias..?

2012-06-25 Thread Kenji Hara
() without using templates as in g()? The type of 'alias this' symbol works as like the super class of user defined class. Therefore, Ranged!(...) is always implicitly convertible to int by 'alias _value this', and there is no way to disable such conversion. Kenji Hara

Re: front doesn't compile for arrays of immutable data

2012-06-25 Thread Kenji Hara
://d.puremagic.com/issues/show_bug.cgi?id=6336 I've already posted a pull request to fix the bug, but it has been hold a while. Kenji Hara

Re: to!(ubyte[])()

2012-06-22 Thread Kenji Hara
string always throws exception. Kenji Hara

Re: Object Cast

2012-06-21 Thread Kenji Hara
On Thursday, 21 June 2012 at 10:33:41 UTC, Namespace wrote: To solve the problem of converting a Object to a specific template class i wrote this little function. But the mixin disturbs me. How i can get the type (in this example Vector2D) without to mix a mixin and T.stringof? [code] T

Re: Why doesn't alias this work with arrays?

2012-06-18 Thread Kenji Hara
, it is a bug. Kenji Hara

Re: alias this with property enforce

2012-06-06 Thread Kenji Hara
On Wednesday, 6 June 2012 at 18:12:39 UTC, Namespace wrote: If i have this code: class Bar { public: Foo GetFoo() { return this._foo; } alias GetFoo this; } to allow access to Foo methods from Bar i get the error, that GetFoo isn't a property if i use -property. Why? The solution

Re: How to test for equality of types?

2012-05-20 Thread Kenji Hara
On Saturday, 19 May 2012 at 18:17:16 UTC, Matthias Walter wrote: On 2012-05-19 15:28, Philippe Sigaud wrote: On Sat, May 19, 2012 at 12:23 PM, Matthias Walter xa...@xammy.homelinux.net wrote: I would open a bug report with the following code which is a bit smaller than my first wrong

Re: How to test for equality of types?

2012-05-20 Thread Kenji Hara
On Sunday, 20 May 2012 at 06:57:20 UTC, Kenji Hara wrote: On Saturday, 19 May 2012 at 18:17:16 UTC, Matthias Walter wrote: Using the current git version of dmd I realized that C works! Hence, as a workaround it can be used by creating a local alias A and subsequently using A.Alias

Re: How to test for equality of types?

2012-05-20 Thread Kenji Hara
On Sunday, 20 May 2012 at 06:57:20 UTC, Kenji Hara wrote: On Saturday, 19 May 2012 at 18:17:16 UTC, Matthias Walter wrote: On 2012-05-19 15:28, Philippe Sigaud wrote: On Sat, May 19, 2012 at 12:23 PM, Matthias Walter xa...@xammy.homelinux.net wrote: I would open a bug report

Re: Make all functions from std.typecons Proxy inout

2012-05-11 Thread Kenji Hara
On Thursday, 10 May 2012 at 07:32:42 UTC, Namespace wrote: Can you explain me how TemplateThisParameter works? I read in the manual but a more detail explanation would help me a lot. Hmm, I have thought following code should work about foo, but doesn't. import std.stdio; struct Proxy {

Re: Make all functions from std.typecons Proxy inout

2012-05-09 Thread Kenji Hara
On Wednesday, 9 May 2012 at 06:42:09 UTC, Namespace wrote: On Wednesday, 9 May 2012 at 04:49:39 UTC, Kenji Hara wrote: On Tuesday, 8 May 2012 at 22:58:07 UTC, Namespace wrote: In my development of the Ref / NotNull structure, I came across a problem: All the methods of Proxy aren't inout. Has

Re: Make all functions from std.typecons Proxy inout

2012-05-08 Thread Kenji Hara
, typeof(o) == inout p.g(); } 'Proxy' object should forward its 'this' type to original object. For the purpose, TemplateThisParameter ('this T') works as expected. Kenji Hara

Re: Extending std.format.formattedRead

2012-04-24 Thread Kenji Hara
, there is not yet general way. The definition of unformatValue for user-defined type in different module isn't considered by std.format module. D's module system is closed in basic. Kenji Hara

Re: appending newly initialized struct to array

2012-04-18 Thread Kenji Hara
} Is that a bug or a feature? I might have opened it but I don't remember now. :) Ali Bye. Kenji Hara

Re: Metaprogramming work around

2012-04-17 Thread Kenji Hara
Hello, but doesn't with the type string. (string is an aliased name of immutable(char)[], and it is built-in array type.) http://dlang.org/template.html#TemplateAliasParameter Kenji Hara

Re: appending newly initialized struct to array

2012-04-17 Thread Kenji Hara
/struct.html#StructLiteral and it is an expression. Bye. Kenji Hara

Re: const AB c = {a,20, numbers};

2012-04-16 Thread Kenji Hara
the code above accept the const(int []) ? Should do. It is a compiler bug. I've filed this issue in bugzilla: http://d.puremagic.com/issues/show_bug.cgi?id=7929 And posted a pull request to fix compiler code: https://github.com/D-Programming-Language/dmd/pull/884 Thanks. Kenji Hara

Re: Templates in classes = what is wrong?

2012-04-16 Thread Kenji Hara
* a; }; Bye. Kenji Hara

Re: A problem with mutable toString

2012-04-09 Thread Kenji Hara
std.format doesn't support const class formatting with upcasting to mutable Object and using mutable toString(). Is this good/expected? It is a gap between language const system and object.Object class interface. I think Phobos should not break const system in basic. Kenji Hara

Re: Problem about lambda expressions

2012-03-27 Thread Kenji Hara
On Tuesday, 27 March 2012 at 13:42:30 UTC, Tongzhou Li wrote: Hello again! I'm learning D, and I encountered a problem. I tried this code: http://ideone.com/hkpT6 It works well. (Have no idea why codepad.org failed to compile it) I tried to write a lambda instead of function f, but I got

Re: Confused by refusal to expand template

2012-03-25 Thread Kenji Hara
On Friday, 23 March 2012 at 23:01:43 UTC, Timon Gehr wrote: On 03/23/2012 11:58 PM, David wrote: Am 23.03.2012 23:52, schrieb H. S. Teoh: Code: struct S { int f(K)(K x) { return 1; } void func(K)(inout(K) x) { auto h = f(x); } } void main() { S s; s.func(abc); // This is line 44 } This

Re: Regarding writefln formatting

2012-03-22 Thread Kenji Hara
On Wednesday, 21 March 2012 at 01:26:23 UTC, bearophile wrote: import std.stdio; void main() { auto mat = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]; writefln(%(%(%d %)\n%), mat); writeln(); writefln([%(%(%d %)\n%)], mat); writeln();