lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 05/10/2015 06:53, Coda Highland wrote:
> Just wondering if you had considered an API like:
> 
> dc:openDocumentWithContentsOfURL{fileurl, display=true, error=nil}

I agree that the syntax looks nicer, but there are a couple of
challenges: first, you're now resolving the method name a lot later,
which is a bit of a pain (but can be overcome); second, and more
importantly, you need to construct the method name by pulling the keys
out of the table *in the right order*. The example you've given is fine
but how would you correctly construct a method name out of

dc:shouldCloseWindowController({wc, delegate=d, shouldCloseSelector=s,
contextInfo=c})

(or {wc, delegate=d, contextInfo=c, shouldCloseSelector=s}, which is
exactly the same table)?

Given that - and the fact that the syntax I have gone with is familiar
to users of other bridges such as PyObjC - I don't think it's worth the
change for a bit of syntactic sugar.

S