23 ms·
Ruby, Python, etc all do this fairly well if you're talking about dict/assoc.array literals and ease of serialization/deserialization.
by WaxProlix 9y ago
Ruby, Python, etc all do this fairly well if you're talking about dict/assoc.array literals and ease of serialization/deserialization.
- TallGuyShort 9y agoYeah Python does well, but boy I wish dynamic properties were smoother sometimes, e.g.: a[b][c] == a.b.c. But I'd rather Python be Python than compromise correctness for PHP-like flexibility :)
- int_19h 9y agoYou could implement an object that does it this way - it would basically implement __getitem__ and __getattr__ identically.
- WaxProlix 9y agoThis causes all sorts of problems, though. If you conflate the language's symbol table with a data structure managed by the language (ie, a hash or dict) then suddenly you have the same problems as JS did for ages. I can't put a '__init__' or ' ' in my key names anymore, or any of the other special cases. Best to leave them as hash keys.