Short list with things to finish for D2

Pelle Månsson pelle.mansson at gmail.com
Wed Nov 25 11:56:20 PST 2009


Denis Koroskin wrote:
> On Wed, 25 Nov 2009 21:11:48 +0300, Ellery Newcomer 
> <ellery-newcomer at utulsa.edu> wrote:
> 
>> On 11/25/2009 10:46 AM, Don wrote:
>>> Denis Koroskin wrote:
>>>>>> I recall that Visual Basic has UBound function that returns upper
>>>>>> bound of a multi-dimensional array:
>>>>>> Dim a(100, 5, 4) As Byte
>>>>>> UBound(a, 1) -> 100
>>>>>> UBound(a, 2) -> 5
>>>>>> UBound(a, 3) -> 4
>>>>>> Works for single-dimensional arrays, too:
>>>>>> Dim b(8) As Byte
>>>>>> UBound(b) -> 8
>>>
>>>> I brought a point that VB has a UBound function that does exactly what
>>>> opDollar is supposed to do, so something like opUpperBound() might fit.
>>>
>>> Finally, a viable alternative to opDollar! I could live with
>>> opUpperBound.
>>
>> <nitpick>
>>
>> VB's ubound doesn't do exactly the same thing as $; in your code snippet
>>
>> b(0)
>> b(8)
>>
>> are both valid elements.
>>
>> Does opUpperBound imply an opLowerBound?
>>
>> In VB you can declare things like
>>
>> dim a(20 to 100, 5, 1 to 4) as Byte
>>
>> LBound(a,1) -> 20
>>
>> Yep. Visual Basic. Awesome language. *Cough*
> 
> Lower bound is always 0 in D, unlike VB where is can take an arbitrary 
> value. As such, there is no need for opLowerBound in D.
Why does it make any sense that the lower bound of any arbitrary class 
needs to be 0?

I'd say opUpperBound is as wrong as opEnd.



More information about the Digitalmars-d mailing list