ElementEncodingType and immutable
bioinfornatics
bioinfornatics at feforaproject.org
Fri Nov 22 01:22:15 PST 2013
On Friday, 22 November 2013 at 07:54:45 UTC, Jonathan M Davis
wrote:
> On Friday, November 22, 2013 01:01:52 bioinfornatics wrote:
>> hi with this code: http://www.dpaste.dzfl.pl/2f830da1
>> I do not understand why alias Char is equal to immutable(char)
>>
>> How to fix these issues?
>
> I'm not quite sure which line you're refering to here, but
> ElementEncodingType
> is going to give the same constness as the elements - e.g.
> ElementEncodingType!string is going to be immutable(char), not
> char.
>
> Also, you're doing something with AAs, and all keys for AAs are
> immutable,
> even if you don't explicitly mark them as immutable, so if if
> the type that
> you're using ElementEncodingType was a key in an AA, that could
> be your
> problem.
>
> However, the first error that's popping up seems to relate to
> the fact that
> ranges treat strings as ranges of dchar, not char, so sequence
> gives you
> letters which are dchar, not char, and then you try and assign
> it to an AA
> which holds immutable(char) rather than dchar (and the fact
> that the AA holds
> immutable(char) rather than char might cause further problems
> with being able
> to reassign anything in the AA - and if it doesn't it's
> probably due to the AA
> doing casting internally when it shouldn't).
>
> - Jonathan M Davis
Thanks Jonathan
I try to have a dynamic type
If sequence is immutable(char)[] AA become char[ubyte]
If sequence is immutable(dchar)[] AA become dchar[ushort] …
More information about the Digitalmars-d-learn
mailing list