crazy programming language thoughts

Ryan Lowe ryanlowe0 at msn.com
Fri Aug 22 20:12:39 EDT 2003


"Terry Hancock" <hancock at anansispaceworks.com> wrote in message
news:3PKdnXyDgbmng9uiXTWJiA at august.net...
> Istvan Albert wrote:
> > Ryan Lowe wrote:
> >  >>>>v = read lines from 'file.txt';
> > join it with '\n'; lower it; split it at '.'
> >
> > split line at '\n' is no better than line.split("\n")
> > after all then you could argue that you should be
> > able to say "'\n' is the splitting character in line" or
> > "break into pieces at '\n'" and so on.

my intentions are much humbler. im not trying to go for true
natural-language capabilities. my split syntax is fixed just as it is in
python, except in terms of the order of the parameters in some cases.

> Yeah, I think this is ultimately the problem with "English-like"
> syntax.  The fact that Python's syntax (one of many examples)
> is more like mathematical notation is a cue to both the author
> and the reader that a more exacting attention to syntax is
> required.   Maybe this is what they really meant by "one obvious
> way to do it" versus "there's more than one way to do it": in
> English there are many -- maybe infinitely many -- ways to say
> essentially the same thing.
>

i agree that wordiness is a trend in most if not all of the english-like
programming languages ive looked at. human languages are wordy to
disambiguate and also to overcome discrepencies in what people know.
programming languages, in contrast, are consise and unambiguous. id like to
maintain this as much as possible, and at the same time increase the clarity
beyond what python has already done. more like super-psudeo-code than true
natural language. PERL is exactly what id like to avoid: too flexible and
much to cryptic ("there's more than one way to do it" is perl's motto,
right?)

> and while I find SQL very useful in its limited application
> domain, I wouldn't really want to turn it into a real
> programming language*!
>

why does a readable language need to be limited? this is exactly what i want
to understand/disprove. i am attempting to build on python, an already
powerful language. i only want to make it more english-like if it not only
makes things clearer but adds meaning. for example, looking back on the
example statement i gave:

>>> v = read lines in 'book.txt'; join it with ''; lower it; split it at
'<pagebreak>'

 i noticed that the 'it' was unnecessary. i could have said:

>>> v = read lines in 'book.txt'; join with ''; lower; split at
'<pagebreak>'

nearly as clear with less writing. in fact its just about as short as the
python equivalent. well i need to do some more thinking on this over the
weekend...

another thing i was playing around with, perhaps stemming from some of the
languages ive been looking into, is parts of speech. for example, functions
should be verbs and knowing that, some transformations may be possible. a
boolean question for an if statement may be derivable from that function
automagically:

 >>> if a was replaced with b in c :

could be derived from the replace function by using this rule:

>>> if replace a with b in c == a :

which has the same meaning but isnt as 'nice.' again the 'was' could be
eliminated for brevity.








More information about the Python-list mailing list