Re: Another reason for overriding default keywords

Alexandre Passant wrote:
> On Sun, Jul 31, 2011 at 3:11 PM, Nathan <nathan@webr3.org> wrote:
>> Alexandre Passant wrote:
>>> The json_decode method in PHP creates PHP objects, and attributes can
>>> be retrieved using $name->attribute.
>>> Yet, attribute cannot start with a @
>>>
>>> So $object->@ won't work, but $object->uri will be OK.
>> Attribute names can be anything in PHP (even NULL!) you use the
>> $object->{'@context'} style to access non standard attribute names, although
>> it's not quite as clean as $object->context that's for sure :)
> 
> Right, well spotted. But that's not the default approach - and I'd
> rather make it as simple as possible.

Likewise, I fully agree with you - it's just how to do that without 
creating name collision with potential property names.

Many people approach this problem by splitting the data in to, a head 
portion and a data portion, like the sparql results format, unsure if 
that's viable for us (?) as it would remove many of use cases which 
involve bootstrapping to existing data sources (as it would potentially 
change their data structure in a non BC way).

FWIW, the $object->{'value'} syntax will still be needed for those 
properties with a colon in the name, since PHP can't handle them 
natively either.

Best,

Nathan

Received on Sunday, 31 July 2011 14:26:23 UTC