Re: [PATCH] Exorcise "zero-dimensional" arrays (Was: Re: Should array_length() Return NULL)

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>
Cc: Florian Pflug <fgp(at)phlo(dot)org>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Brendan Jurd <direvus(at)gmail(dot)com>, Josh Berkus <josh(at)agliodbs(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Exorcise "zero-dimensional" arrays (Was: Re: Should array_length() Return NULL)
Date: 2013-04-03 16:16:48
Message-ID: CAFj8pRCX+9oS5kCuqOzQQ_ayGp+-vPpj7JV3f+5LHGKye6JBFg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2013/4/3 Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>

> On 04/04/13 04:58, Pavel Stehule wrote:
>
>
>
>
> 2013/4/3 Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>
>
>> On 04/04/13 03:02, Florian Pflug wrote:
>>
>>> On Apr3, 2013, at 15:30 , Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
>>>
>>>> On 04/02/2013 02:46 PM, Florian Pflug wrote:
>>>>
>>>>> If we're going to break compatibility, we should IMHO get rid of
>>>>> non-zero lower bounds all together. My guess is that the number of
>>>>> affected users wouldn't be much higher than for the proposed patch,
>>>>> and it'd allow lossless mapping to most language's native array types…
>>>>>
>>>> That would actually break a HUGE number of users, since the default
>>>> lower
>>>> bound is 1. I have seen any number of pieces if code that rely on that.
>>>>
>>> Uh, yeah, we should make it 1 then, not 0, then. As long as the bound
>>> is fixed, conversion to native C/Java/Ruby/Python/... arrays would still
>>> be lossless.
>>>
>>> best regards,
>>> Florian Pflug
>>>
>>>
>>> Zero as the default lower bound is consistent with most languages
>> (especially the common ones like C, C++, Java, & Python), in fact I don't
>> remember any language where that is not the case (ignoring SQL) - and I've
>> written programs in about 20 languages.
>>
>
> pascal, ADA, and ALGOL like languages
>
> Regards
>
> Pavel
>
> ALOGOL 60 was zero based by default, as I remember deliberately
> setting the lower bound to 1, I managed to avoid PASCAL and I only glanced
> at ADA.
>

http://en.wikipedia.org/wiki/Comparison_of_programming_languages_%28array%29

Regards

Pavel

>
>
> Cheers,
> Gavin
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2013-04-03 16:21:38 Re: [PATCH] Exorcise "zero-dimensional" arrays (Was: Re: Should array_length() Return NULL)
Previous Message Gavin Flower 2013-04-03 16:09:01 Re: [PATCH] Exorcise "zero-dimensional" arrays (Was: Re: Should array_length() Return NULL)