crazy programming language thoughts

Ryan Lowe ryanlowe0 at msn.com
Thu Aug 28 18:33:35 EDT 2003


"Christopher Barber" <cbarber at curl.com> wrote in message
news:psowud0miq4.fsf at unicron.curl.com...
> Tim Roberts <timr at probo.com> writes:
>
> > "Ryan Lowe" <ryanlowe0 at msn.com> wrote:
> > >
> > >one of the things i love about python is its use of the actual words
> > >or/and/not/is/in, where other languages would use symbols ||/&&/?!@#$%,
what
> > >have you.
> >
> > The "other languages" thing is a little one-sided.  C and C++ are really
> > the only mainstream languages to use symbols for these constructs.
>
> and Java and C# and Tcl and Perl and Javascript, all influenced by C of
course.
>
>  - C

ok, but my main point wasnt about disliking symbols, per se, as long as they
are appropriate. for instance, the $ meaning 'scalar' and the @ meaning
'array' in front of perl variables are near arbitrary symbols in my mind, as
are the && and || in c++. what i am attempting to figure out, is if there is
a way to improve the intuitiveness of the python's syntax, specifically
concerning functions. the basic idea i started with was:

> > "Ryan Lowe" <ryanlowe0 at msn.com> wrote:
>the basic concept would be to use identifying words in front of the
>arguments to determine their identity as well as making the function call
>read more like an english phrase. for instance, take the simple python
>statement:
>
>>>> vtext.replace('a', 'b')
>
>wouldnt it be nicer (more english-like at least) to say:
>
>>> replace 'a' with 'b' in vtext

ive been playing around with the notion of part of speech. ive come up with
this rule:

functions are defined starting with a present-tense single-word verb,
followed by a noun target (not necessarily a variable), followed by any
other words and/or variables (at least one word must separate each
variable). this reads well when the function call is a statement like the
example in the quote.
however, it reads less well in assignments, conditions, and parameters,
where its used as an expression. in such cases, the function calls read
better as noun phrases. i noticed that you can convert a function to the
noun-form pretty easily, given the function is of the format above, by
taking the past-tense of the verb and swaping the first two words, like so:

join listv with '' # verb phrase
stringv = listv joined with '' # noun phrase
get fruit from bowlv # verb phrase
apples, oranges = fruit got from bowlv # noun phrase
if 'a' replaced with 'b' in textv : # noun phrase
replace av with bv in listv joined with gluev # combo

a dictionary of english verb suffixes can be used to automatically define
the past tense of a verb, even for made-up verbs in many cases, e.g.
asparagate (turn something into an asparagas), can still be resolvable from
the suffix ate-> ated.

so do people think this is an improvement over dot syntax? i think it reads
better, but then i thought of it ;-)
do you think it would confuse people in terms of which part is a parameter
of what when combining 2 functions like the combo example?
can anyone think of a scenario where it wouldnt work? it only takes care of
methods, i havent figured out how to de-dottify class functions and class
attributes. others pointed out that other languages use labels for
arguments, but i dont know any that use this rule system.













More information about the Python-list mailing list