News for hackers. Stuff that matters.
Re:Luon programming language combines concepts from Oberon a... by neonsunset on Saturday December 14, 2024 @03:50PM (#42419342)
[^n] indexing is mapped to an 'Index' struct by Roslyn which can then be applied to any array or list-shaped type (it either has to expose Index-accepting indexer, or a plain integer-based indexer and Count or Length property. There really isn't much to optimize away besides the bounds check since there are no object allocations involved.

A similar approach also works for slicing the types with range operator e.g. span[start..end].

There are no comments on this comment yet.