English-like Python

Aaron Brady castironpi at gmail.com
Tue Feb 3 16:59:53 EST 2009


On Feb 3, 2:01 pm, "J. Cliff Dyer" <j... at sdf.lonestar.org> wrote:
> On Tue, 2009-02-03 at 08:33 -0700, Joe Strout wrote:
> > J. Cliff Dyer wrote:
>
> > > But what if your language allows functions to be used as first class
> > > objects?  (Mine does :))  
>
> > > x = Beep
>
> > > Does that assign the name x to the Beep object or does it assign the
> > > result of a Beep call to x?
>
> > It assigns the result.  To assign the name to the Beep object requires a
> > bit of additional syntax; in RB, this would be
>
> >   x = AddressOf Beep
>
> > > There's no virtue in making ridiculously simple things even simpler if
> > > it makes the interesting things impossible.
>
> > Of course.  The goal is (or should be) to make the common things
> > ridiculously simple, and make the uncommon things only somewhat less so.
> >   Even in Python, it is far more common to invoke a function than to
> > need a reference to it.  So invoking a function should be the thing that
> > requires no extra syntax (even including "()").  Getting a reference to
> > it, which is less common, should be the thing that requires more syntax.
>
> Except that now you have introduced an inconsistency into python.  What
> does the following mean?
>
> my_object = MyObject()
> x = my_object
>
> What if MyObject defines a method named __call__?
>
> Now some objects are passed around using
>
> x = my_object
>
> while others require
>
> x = AddressOf my_object
>
> and the only way to tell which is which is to check the object for the
> presence of a __call__ method.  
>
> This seems like a serious inconsistency to me.
>
> > Cheers,
> > - Joe
>
> Cliff

Well, just return to the natural language we're trying to model.

x= going to the store
x= go to the store

Imperatives don't usually return values.

x= the process of going to the store
x= the result of going to the store

I'm starting to think that PLs and NLs are quite dissimilar.  What do
return values are denoting phrases:

x= the man in the corner
x= the man in the corner talking to the woman

Once you've established the subject, you usually make declarations
about him/er/it.

was_at_the_mall_today( x )
talked_to_me_earlier( x )

Usually you expect your audience to have reasoning capacities, and
giving them declarative knowledge is preemptive to the need to give
them orders later on.

Ideally, interactions could take place entirely in the declarative:
introduce yourself and wait-style.



More information about the Python-list mailing list