When is a slice not a slice?

Alix Pexton via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jun 7 02:17:00 PDT 2014


On 06/06/2014 7:39 PM, Steven Schveighoffer wrote:
> On Fri, 06 Jun 2014 06:14:30 -0400, Rene Zwanenburg
> <renezwanenburg at gmail.com> wrote:
>
>>
>> Immutables should be usable at compile time and not allocate a new
>> instance on every use when in module scope.
>
> I was about to say this. But immutable can have its own set of issues.
> If you want strictly compile-time generation of data, then immutable is
> the way to go.
>
> But if you want to use it at runtime as well, immutable can hamper some
> things. I'm sure your example is a very small or reduced snippet of what
> you are actually doing.
>
> -Steve

I re-factored my actual code to not need the slices at all as no matter 
how I tried to use them at compile time it broke one of my invariants.I 
now have enums that I can use at compile time to generate more enums 
(via set operations, etc) and at runtime, so I'm happy.

A...


More information about the Digitalmars-d-learn mailing list