Atoms, Identifiers, and Primaries

Chris Angelico rosuav at gmail.com
Wed Apr 17 21:56:50 EDT 2013


On Thu, Apr 18, 2013 at 9:40 AM, Mark Janssen <dreamingforward at gmail.com> wrote:
> On Tue, Apr 16, 2013 at 8:55 PM, rusi <rustompmody at gmail.com> wrote:
>> On Apr 17, 7:57 am, Bruce McGoveran <bruce.mcgove... at gmail.com> wrote:
>>> 3.  Section 5.3.1 offers this definition of an attributeref:
>>>     attributeref ::= primary "." identifier
>>>
>>
>> One general comment I will make is regarding your distress at what you
>> call 'circular'
>> Circular just means recursive and recursion is the bedrock for
>> language-design.
>
> Rercursion the "bedrock" of language-design.  I don't think so.  From
> what I know, a well-defined language ends at its symbols.  It makes no
> use of "infinities".

There's a difference between infinite and recursive, though. I was
defining a function (it converted from JSON to an internal format) and
wanted to explain that not all of JSON would reliably round-trip (ie
be able to be translated to the internal format and then back again).
To describe what _would_ round-trip correctly, I used this simple yet
technically illegal description:

typedef valid string|array(valid)|object(string:valid)

In other words, a string is valid, and a list/array of valid elements
is valid, and a dictionary/mapping/object with string keys and valid
elements is valid. It's a recursive definition, but it can't go
infinite (self-references aren't valid - though this isn't stated by
the typedef); however, it can go arbitrarily deep.

ChrisA



More information about the Python-list mailing list