"Mixin is not defined" error when trying to use template mixins

2019-10-27 Thread solidstate1991 via Digitalmars-d-learn
There's a template mixin in my dimage project's new version in base.d, and when I try to access it from another file I get two errors: undefined identifier `ChunkyAccess4bit`, did you mean template `ChunkyAccess4Bit()`? and mixin `dimage.tga.TGA.ChunkyAccess4bit!()` is not defined Should

Re: Using a char value >= 128

2019-10-27 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, October 27, 2019 6:44:05 AM MDT Per Nordlöw via Digitalmars-d- learn wrote: > In which circumstances can a `char` be initialized a non-7-bit > value (>= 128)? Is it possible only in non-@safe code? > > And, if so, what will be the result of casting such a value to > `dchar`? Will that

Re: The compiler can't "see" an inner class

2019-10-27 Thread Emmanuelle via Digitalmars-d-learn
On Sunday, 27 October 2019 at 19:54:06 UTC, Simen Kjærås wrote: It's a bug: interface A { interface B : A { class C : B { } } // Fails: no property 'C' for type 'foo.A.B' void inside(A.B.C c) { } } // Works void outside(A.B.C c) { }

Re: The compiler can't "see" an inner class

2019-10-27 Thread Simen Kjærås via Digitalmars-d-learn
On Sunday, 27 October 2019 at 17:52:51 UTC, Emmanuelle wrote: Hello! See snippet: --- interface AST { static interface Expr : AST { final static class Name : Expr { override void accept(AST.Visitor v) { v.visitName(this); } } } final static

The compiler can't "see" an inner class

2019-10-27 Thread Emmanuelle via Digitalmars-d-learn
Hello! See snippet: --- interface AST { static interface Expr : AST { final static class Name : Expr { override void accept(AST.Visitor v) { v.visitName(this); } } } final static class Visitor { void visitName(AST.Expr.Name

Re: Supporting inout haystack in array-overload of findSplitBefore without template-bloat

2019-10-27 Thread Per Nordlöw via Digitalmars-d-learn
On Sunday, 27 October 2019 at 14:57:29 UTC, Per Nordlöw wrote: @safe pure nothrow @nogc unittest { auto r = "a*b".findSplitAfter_inout('*'); static assert(is(typeof(r.pre()) == string)); assert(r); assert(r.pre == "a*"); assert(r.post == "b"); } Made it work! :) /**

Re: Supporting inout haystack in array-overload of findSplitBefore without template-bloat

2019-10-27 Thread Per Nordlöw via Digitalmars-d-learn
On Sunday, 27 October 2019 at 14:29:01 UTC, Per Nordlöw wrote: which results in the following interesting compiler error: array_algorithm.d(506,12): Error: modify `inout` to `immutable` is not allowed inside `inout` function assert(r.pre == "a*"); ^ array_algorithm.d(507,12):

Re: Using a char value >= 128

2019-10-27 Thread Ernesto Castellotti via Digitalmars-d-learn
On Sunday, 27 October 2019 at 14:36:54 UTC, Ernesto Castellotti wrote: On Sunday, 27 October 2019 at 12:44:05 UTC, Per Nordlöw wrote: [...] char in D is always unsigned, it is not implementation-specific. Therefore it can take values ​​up to (2^8)−1, If you want a signed 8 byte type you can

Re: Using a char value >= 128

2019-10-27 Thread Ernesto Castellotti via Digitalmars-d-learn
On Sunday, 27 October 2019 at 12:44:05 UTC, Per Nordlöw wrote: In which circumstances can a `char` be initialized a non-7-bit value (>= 128)? Is it possible only in non-@safe code? And, if so, what will be the result of casting such a value to `dchar`? Will that result in an exception or will

Supporting inout haystack in array-overload of findSplitBefore without template-bloat

2019-10-27 Thread Per Nordlöw via Digitalmars-d-learn
Is it possible to make this array-overload of findSplitBefore support `inout`-qualified `haystack` parameter and return type without using a templated `Result`? auto findSplitBefore(T)(scope const T[] haystack, // TODO support inout? scope const T needle) {

Re: Using a char value >= 128

2019-10-27 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 27 October 2019 at 12:44:05 UTC, Per Nordlöw wrote: In which circumstances can a `char` be initialized a non-7-bit value (>= 128)? Is it possible only in non-@safe code? All circumstances, `char`'s default initializer is 255. char a; // is 255 And, if so, what will be the result

Using a char value >= 128

2019-10-27 Thread Per Nordlöw via Digitalmars-d-learn
In which circumstances can a `char` be initialized a non-7-bit value (>= 128)? Is it possible only in non-@safe code? And, if so, what will be the result of casting such a value to `dchar`? Will that result in an exception or will it interpret the `char` using a 8-bit character encoding?