Re: Traits

2013-10-12 Thread luminousone
On Saturday, 12 October 2013 at 23:48:56 UTC, Artur Skawina wrote: On 10/12/13 21:42, luminousone wrote: On Saturday, 12 October 2013 at 11:50:05 UTC, Artur Skawina wrote: template isBaseOf(BASE, C) { enum isBaseOf = { static if (is(C S == super)) foreach (A; S)

Re: Beta problems

2013-10-12 Thread Namespace
Forget to say: I use VisualD.

Beta problems

2013-10-12 Thread Namespace
I can't reproduce the error but with the current beta I get in a specific project this output: Compiling Audio\Core\core.d... D:\D\dmd2\windows\bin\..\..\src\phobos\std\array.d(15): Error: importing package 'memory' requires a 'package.d' file which cannot be found in 'core\memory\package

Re: Traits

2013-10-12 Thread Artur Skawina
On 10/12/13 21:42, luminousone wrote: > On Saturday, 12 October 2013 at 11:50:05 UTC, Artur Skawina wrote: >>template isBaseOf(BASE, C) { >> enum isBaseOf = { >> static if (is(C S == super)) >> foreach (A; S) >>static if (is(A==BASE)) >>

Re: Begining with D

2013-10-12 Thread Adam D. Ruppe
On Saturday, 12 October 2013 at 21:27:18 UTC, 1100110 wrote: I had issues with getch() on ConsoleD... What was it? I fixed a bug in it right before posting that message the other day so it might be fixed now. If you too have issue, you can try github.com/D-Programming-Deimos/ncurses which h

Re: Begining with D

2013-10-12 Thread 1100110
On 10/10/2013 02:36 PM, Adam D. Ruppe wrote: On Thursday, 10 October 2013 at 19:19:53 UTC, Ali Çehreli wrote: import std.c.linux.termios; worth noting that this is Linux only. doing it on Windows is a little different. Working with console/terminal input and output can get surprisingly comple

Re: Traits

2013-10-12 Thread luminousone
On Saturday, 12 October 2013 at 11:50:05 UTC, Artur Skawina wrote: On 10/12/13 13:42, Artur Skawina wrote: template isBaseOf(BASE, C) { static if (is(C S == super)) enum isBaseOf = { foreach (A; S) static if (is(A==BASE)) return true

Re: Method of another module is callable, even if they is private.

2013-10-12 Thread Namespace
On Saturday, 12 October 2013 at 19:07:44 UTC, Andrej Mitrovic wrote: On 10/12/13, Namespace wrote: Bug or feature? :P Has to be a bug. Reduced: - module a; import b; void main() { auto s = S(); auto f = &s.f; // no error f(); // no error auto sf = &S.sf; // error } -

Immutable variadic lambda

2013-10-12 Thread bearophile
This program causes me a crash, do you know if it's a problem of mine, a known bug, or an unknown one? void main() { static foo = (int[] x...) => 0; foo(); } A similar problem: import std.typecons: Tuple; void main() { alias Foo = Tuple!(int); static bar = (Foo x) => 0; b

Re: Method of another module is callable, even if they is private.

2013-10-12 Thread Andrej Mitrovic
On 10/12/13, Namespace wrote: > Bug or feature? :P Has to be a bug. Reduced: - module a; import b; void main() { auto s = S(); auto f = &s.f; // no error f(); // no error auto sf = &S.sf; // error } - - module b; struct S { private void f() { } private s

Method of another module is callable, even if they is private.

2013-10-12 Thread Namespace
A.d: import B; class Foo { public: void call(Bar b) { b.test(42); } } void main() { Bar b = new Bar(); Foo f = new Foo(); f.call(b); } B.d: import std.stdio; class Bar { private: void test(int id) {

Re: Traits

2013-10-12 Thread Artur Skawina
On 10/12/13 13:42, Artur Skawina wrote: >template isBaseOf(BASE, C) { > static if (is(C S == super)) > enum isBaseOf = { > foreach (A; S) >static if (is(A==BASE)) > return true; > return is(C==BASE); > }(); >

Re: Traits

2013-10-12 Thread Artur Skawina
On 10/11/13 06:13, Agustin wrote: > I have a function that needs to check if the template provided inherit a > class. > > For example: > > public void function(T, A...)(auto ref A values) > { > // static assert(IsBaseOf(L, T)); > } > > Check if T inherit class "L". Same result that std::is_ba

Re: Traits

2013-10-12 Thread Jonathan M Davis
On Saturday, October 12, 2013 11:50:27 luminousone wrote: > On Saturday, 12 October 2013 at 08:40:42 UTC, Jonathan M Davis > > wrote: > > On Saturday, October 12, 2013 10:24:13 luminousone wrote: > >> 1. > >> > >> opCast, and alias can break the cast approach. You pointed this > >> out yourself.

Re: Traits

2013-10-12 Thread luminousone
On Saturday, 12 October 2013 at 08:40:42 UTC, Jonathan M Davis wrote: On Saturday, October 12, 2013 10:24:13 luminousone wrote: 1. opCast, and alias can break the cast approach. You pointed this out yourself. And as I pointed out, that's perfectly acceptable in most cases, because what you c

Re: Traits

2013-10-12 Thread Jonathan M Davis
On Saturday, October 12, 2013 10:24:13 luminousone wrote: > 1. > > opCast, and alias can break the cast approach. You pointed this > out yourself. And as I pointed out, that's perfectly acceptable in most cases, because what you care about is the conversion. alias this is specifically designed w

Re: Traits

2013-10-12 Thread luminousone
On Saturday, 12 October 2013 at 07:47:18 UTC, Jonathan M Davis wrote: On Saturday, October 12, 2013 09:32:09 luminousone wrote: And again, the casting solution is a bloody hack, it is loaded with corner cases that will break things if you are not aware of them. It also requires an allocated in

Re: Traits

2013-10-12 Thread Jonathan M Davis
On Saturday, October 12, 2013 09:32:09 luminousone wrote: > And again, the casting solution is a bloody hack, it is loaded > with corner cases that will break things if you are not aware of > them. It also requires an allocated instance of that object Of course, it requires an instance of the obje

Re: Traits

2013-10-12 Thread luminousone
On Saturday, 12 October 2013 at 05:38:16 UTC, Jonathan M Davis wrote: On Friday, October 11, 2013 22:31:25 Jonathan M Davis wrote: On Saturday, October 12, 2013 00:54:48 luminousone wrote: > The inability to handle null is pretty big, specially > considering > that at not point is the class in