Hacker News new | past | comments | ask | show | jobs | submit login

Would you mean this to be a namespace which only the Python implementation could access? For example, if the protocol "it:next" is added (which is equivalent to next(it)) then is there any way to support that syntax in an older version? With next() as a builtin it's easy; try: next except NameError, and in case of exception, implement the function yourself. But if I can't implement it myself then there's no good migration path.

With your particular choice of ":", then what would "d={a:length()}" be? Currently it's a 1-element set. What would "words[middle:length()]" do?




"is there any way to support that syntax in an older version"

Nop, that is exactly what I meant with decisions haunting you forever. You better start a new language than radically change the current implementation.

With regard to my particular choice of ':' there are three solutions:

1. pick any of the 100k unicode chars for internal methods but imperative is to differentiate them to freely use attributes and methods as pleased.

2. force the compiler and the coder to disambiguate the possible same use as internal method: first assign then use n=a:length(), d={n}

3. design the language to use .. as slicer and {a=b} as dictionary assignment.

Again, we are talking about design decisions for a new language, not to change the core of an existing language which is not an easy task. That is exactly why language design is not an exact science an very few make it to stardom.


My point is that it isn't "as simple as using another char." #1 doesn't work if you want things visible on most keyboards in the world. #2 is counter to a design principle (which Python uses) that humans are less good at resolving ambiguity than people (see "template <template <int>>" in C++ pre 2011), and #3 as a specific case means problems getting methods of floats, as in "1..hex()". Of course Python has that already with "1 .bit_length()" being different than "1.bit_length()".

I agree that seemingly minor decisions can have a big impact in the future of a language. What I disagree with is that this choice of a special syntax for built-in methods is "simple", and I believe that doing it yields a language not meant for stardom.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: