Re: [Pyobjc-dev] Objective-P?
Brought to you by:
ronaldoussoren
From: Aahz <aa...@py...> - 2009-11-16 20:24:32
|
On Mon, Nov 16, 2009, Anders Hovm?ller wrote: > > I thought about this thing a little bit more and realized that the obj-c > calling syntax is totally unambiguous with python. It's a pretty minor > change to the regex actually. As I understand it there are three cases: > 1. [1, 2, 3] # explicit list > 2. [x for x in foo] # list comprehension > 3. [foo bar] # objc message send > So the only thing I needed to do was to split once on zero or more spaces > and if the second identifier is "for" or begins with comma it's python code > and I should leave it alone. If it passes this test it is invalid python > code anyway so I can easily assume it's an objc-style call and just convert > it. Please tell me if there is a case I missed. You need to use a real parser as Ronald indicated: [ #test 1 , ] Also, I agree with Ronald that "$[foo bar]" overall makes more sense with Python. (This is my opinion as someone who has done functionally zero ObjC programming but with more than ten years of Python.) However, because there's essentially zero chance of getting this integrated into Python it doesn't much matter. -- Aahz (aa...@py...) <*> http://www.pythoncraft.com/ "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." --Brian W. Kernighan |