FAQ
disclaimer:
this is a little out-there, primarily a thought excersise for myself. it
probably belongs in group on programming language theory. but python got me
thinking about this, so here it is. and dont worry, its NOT a change
proposal.

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 symbols dont save you much typing (especially if you count the
shift key), but are merely something extra to learn and remember. i also
like how python did away with the unneccesary parentheses in for/if/while
statements. soooo ive been toying with the idea of getting rid of parens in
functions too (ive just been reading the ruby tut and noticed parens are
optional in some cases which is cool, but trust me this is different)

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
since the arguments have an identifying word (with, b) (in, vtext), the
order isnt important (other than the first 'anchor' word(s)), so we could
instead have said:
replace 'a' in vtext with 'b'
or
replace in vtext 'a' with 'b'
ignoring that the last version is a little awkward to say, the advantage is
immediate understandability; each parameter's contribution is explicitly
stated so you dont have to guess or look up what each arg of a many-arg
function does. of course, you could forget what words go in front of the
args (e.g. was it 'in vtext' or 'from vtext'?), but since its english-like i
think less so. plus an editor could give you hints like many do now.

you may be thinking about keyword inflation. however, the parser would
consider the whole set of words together, so the 'in' in the above wouldnt
be bound to the meaning it has in a for statement. worst case scenario, a
naming convention like the v in front of variable names could be used to aid
parsing, but i think it may be possible to disambiguate without such a
convention.

i just want to say that i know i saw a similar idea in another language, a
few years ago, but damned if i remember where or what language. i guess the
language didnt make it:( but if anyone knows a language like this, PLEASE
let me know.

anyway, this is all well and good for this simple example, but lets see how
it scales up. once you get familiar with finctions and dot syntax, you
probably started chaining them together. it saves time and space and after
not so long it becomes pretty easy to write and understand something like
this:
v = '/n'.join(file('file.txt').readlines()).lower().split('.')
but think back to when all this stuff was new. you probably would have
written:
f = file('file.txt')
v = f. readlines()
v = '\n'.join(v)
v = v.lower()
v = v.split('.')
it may be a little clearer, especially to a beginner, but its not nearly as
convenient. now take a look at this:
v = read lines from 'file.txt'; join it with '\n'; lower it; split it at
'.'

i showed this to a couple non-programmers, and they fould it much easier to
interpret than the first way (i didnt show them the second way). here i do
introduce a new keyword 'it' which you can probably guess contains the
return value of the statement to the left of the semicolon. you could add a
'them' keyword for aggregates (as in the join part) if you are a grammar
stickler.

ill stop here before i put people completely to sleep. im curious what
people think about this. im not concerned with 'minor' problems like the
speed of a parser that could handle this. id like instead to hear comments,
concerns, reguarding the theory. id especially like any links people might
know about interesting experimental programming languages.

Search Discussions

  • Dave Kuhlman at Aug 22, 2003 at 1:19 am

    Ryan Lowe 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
    Incredibly great idea. Unfortunately, it's been done. It's
    called COBOL. It was/is hugely successful. And, by the way,
    whitespace for indentation is significant in COBOL, I believe.

    Dave

    --
    Dave Kuhlman
    http://www.rexx.com/~dkuhlman
    dkuhlman at rexx.com
  • Istvan Albert at Aug 22, 2003 at 1:30 am
    Ryan Lowe wrote:

    v = read lines from 'file.txt';
    join it with '\n'; lower it; split it at '.'

    A distinction needs to be made between a programming
    language that resembles pseudo-code and a language
    that looks like a spoken language.

    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.

    For what is worth perl was always developed along the lines
    you are talking about. See more here.

    http://www.perl.com/pub/a/2003/06/25/perl6essentials.html

    Now whether that is a good thing is very debatable and
    the mere fact that I'm posting in a python group pretty
    much tells who do I vote for.

    Istvan.
  • Terry Hancock at Aug 22, 2003 at 1:47 pm

    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.
    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.

    But a parser that could understand them all would pass the
    Turing Test and want a paycheck. ;-)

    Of course, it is interesting to note that it is the *author* who
    primarily needs this cue. The *reader* benefits from using English
    words instead of abstract symbols. So perhaps this is why
    Python's mix of syntax works well -- not too hard to write, and
    not too hard to read. I'm not even going to speculate about
    whether it is the best such mix. ;-)

    The main language I use that resembles the "English" style
    is SQL:

    SELECT * FROM table_a WHERE field_b LIKE '.*[abc][def]'

    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*!

    Cheers,
    Terry


    *By which I meant "Turing Complete" and nothing else. And
    no value judgements whatsoever. :lol:

    --
    Terry Hancock
    Anansi Spaceworks http://www.AnansiSpaceworks.com/
  • Ryan Lowe at Aug 23, 2003 at 12:12 am
    "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.
  • Sean Ross at Aug 22, 2003 at 1:35 am
    "Ryan Lowe" <ryanlowe0 at msn.com> wrote in message
    news:gDd1b.147992$_R5.55948990 at news4.srv.hcvlny.cv.net...
    i just want to say that i know i saw a similar idea in another language, a
    few years ago, but damned if i remember where or what language. i guess the
    language didnt make it:( but if anyone knows a language like this, PLEASE
    let me know.
    Hi.
    This may not be the language you're trying to recall but it is a language
    that uses English syntax: "AppleScript"

    Check it out here:

    http://developer.apple.com/documentation/AppleScript/Conceptual/AppleScriptLangGuide/index.html

    Unfortunately, it's only available on the Mac.

    I've actually made a language very much like AppleScript. However, before
    you get excited, that language was designed for a *very* specific purpose,
    and you *cannot* use it for general programming of *any kind*. That being
    said, the code is available at:

    http://chat.carleton.ca/~sross

    It was written in Python using SPARK - extending SPARK's included Python
    1.5.2 grammar example. The code is not great: it was written during a course
    at which time I was just learning Python, SPARK, and the steps involved in
    moving from source to executable. (I don't know if I ever want touch it
    again ... ). Anyway, if you're interested, it's there. Maybe you can whip a
    toy version of AppleScript. I'd like to (seriously), but I haven't any
    time - the fall semester is coming up quickly. Maybe after I've finished
    school ...

    Hope that helps, and, if you do make a toy AppleScript, please let me know
    about it!
    Sean
  • Paul D. Fernhout at Aug 22, 2003 at 1:41 am

    Ryan Lowe 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
    i just want to say that i know i saw a similar idea in another language, a
    few years ago, but damned if i remember where or what language. i guess the
    language didnt make it:( but if anyone knows a language like this, PLEASE
    let me know.
    You may be thinking of Smalltalk.
    http://www.smalltalk.org/
    although there are other languages with related phrasing (like in
    HyperCard? and even COBOL?).

    The Python code:

    x = sin(10) + 50 * 20 * self.myfunctionXY(cos(30), 40)

    would be in Smalltalk something like:

    x := 10 sin + (50 * 20 * self myfunctionX: 30 cos y: 40).

    where the order of precedence is unary (sin, cos), binary (+, *) and
    then keyword (myfunctionX:y:). Evaluation is otherwise left to right.
    Note the extra parentheses needed to ensure "*" is done before "+" as
    there is no other order of precedence. Note, Smalltalk has very few
    reserved words --- even things like "if" and "while" are typically done
    in Smalltalk as overrideable keywords of True and False classes (and the
    compiler may optimize these inline in some cases).

    I prefer Smalltalk's keyword type method function calls over Python's
    nameless parameters (yes they can be named but it is inelegant) because
    I think keywords are more self documenting of parameter expectations
    than function calls which do not indicate the possible number of
    paraeters or hint at their uses. However, I do prefer Python's use of
    significant white space over Smalltalk's use of braces to mark off
    blocks. (Although Smalltalk blocks are very powerful idea Python doesn't
    quite have except maybe as nameless functions.)

    I tend to use Python over Smalltalk these days because it is elegant
    enough, has lots of third party modules, has a good user community, has
    a fairly stable core, has books on it, appeals to C coders, is
    reasonably well licensed, and seems reasonably free of worries over
    copyright infringement etc (made easier because the language is
    different from most commercial languages, so there is little temptation
    or possibility to cut and paste library functions from commercial
    implementations).

    But I do miss keywords and Smalltalk's level of integration and
    transparency related to development tools and debugging GUIs down to the
    VM. I also miss changing the program while it runs for a complex GUI
    app; although I have recently learned how to do this some in Python from
    someone elses' usenet post a while back (although reloading a module
    still klunkier than Smalltalk but maybe this can be fixed by a better
    development environment which works more like a Smalltalk image by
    modifying live code).

    Incidentally, I'm not sure if Python really semantically needs the "."
    operator as opposed to a space, in which case it would look a little
    more Smalltalk like. For example:

    self.list.InsertColumn(0, "S")

    would seem to me could still be meaningful as:

    self list InsertColumn(0, "S")

    This of course might freak out some C programmers. But I don't think it
    would be ambiguous (I haven't thought this through completely though).

    But then I might also make ":' optional (despite the argument it is for
    clarity), and I might enforce indentation at two spaces (like Occam) and
    I might enforce variable declarations before use to avoid bugs from
    typos in assignments (like Smalltalk), and I might get rid of the need
    for "self" in object method function declarations (like Smalltalk) by
    making it implicit and enforcing the "self" name for any such reference.
    That last might not be a great idea as one of the nice things about
    Python is that functions and methods don't need to be compiled in
    different ways, unlike Smalltalk where there is a difference in
    compilation structure between blocks and methods, but maybe something
    could be worked through by a smart compiler seeing that a function with
    a reference to self in it was treated specially, and functions assigned
    to method slots could be somehow be upgraded to accept another argument
    if they didn't reference self (or perhaps all functions could take an
    implicit self?).

    I have tried to come up with a way to combine significant white space
    with Smalltalk syntax, but run up against difficulties with indenting
    keyword arguments when nesting keywords. I do think one can mix keyword
    function calls and significant white space easily and usefully, but
    perhaps only if one uses reserved words for block structuring (if, else,
    for, etc.) as opposed to Smalltalk's dynamic blocks. For example, the
    python method declaration

    def addOrFindStringRecord(self, string, readOnlyFlag = 0):
    if not readOnlyFlag:
    self.refreshLockFileIfNeeded()
    self.checkOpen()
    if Options.caching:
    try:
    if self.stringCache.has_key(string):
    location = self.stringCache[string]
    return self.readStringIndexRecord(location)
    except TypeError, e:
    # may generate type error if object not hashable
    pass
    ...

    becomes in this hybrid language (Pytalk?):

    def addOrFindStringRecord: string readOnlyFlag: readOnlyFlag = 0
    if not readOnlyFlag
    self refreshLockFileIfNeeded
    self checkOpen
    if Options caching
    try
    if self stringCache has_key: string
    location = self stringCache[string]
    return self readStringIndexRecord: location
    except TypeError, e
    # may generate type error if object not hashable
    pass
    ...

    (Not sure what to do about brackets, so I left them...)

    I think that combination might be easier to maintain, but alas, Python
    is good enough that I don't see such a more perfect (IMHO) variant
    taking off anytime soon. Also, people would complain about the loss of
    variable length argument lists, and they would say it is good enough for
    IDE's to intelligently display parameter hints when hovering over a
    fucntion name.

    In any case, while Python is, like just about all things in this
    beautiful and mysterious world, not quite perfect, (and also open to
    argument over what perfection is), Python is elegant and fun and
    practical. And thanks be to Guido (and others) for making it happen.

    --Paul Fernhout



    -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
    http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
    -----== Over 100,000 Newsgroups - 19 Different Servers! =-----
  • Roberto Amorim at Aug 22, 2003 at 1:03 pm

    The Python code:

    x = sin(10) + 50 * 20 * self.myfunctionXY(cos(30), 40)

    would be in Smalltalk something like:

    x := 10 sin + (50 * 20 * self myfunctionX: 30 cos y: 40).
    In fact, that would be

    x := 10 sin + (50 * 20 * (self myfunctionX: 30 cos y: 40)).

    unless you want to call myfunctionX:y: over the result of (50*20*self). :-)

    I love Python, and by far it's the language I use the most. However, when it
    comes to languages, Smalltalk is still my favorite. :-)
  • David Boddie at Aug 22, 2003 at 8:55 pm
    "Paul D. Fernhout" <pdfernhout at kurtz-fernhout.com> wrote in message news:<3f457487_7 at corp.newsgroups.com>...
    Ryan Lowe wrote:
    [More "natural" language syntax]
    i just want to say that i know i saw a similar idea in another language, a
    few years ago, but damned if i remember where or what language. i guess the
    language didnt make it:( but if anyone knows a language like this, PLEASE
    let me know.
    You may be thinking of Smalltalk.
    http://www.smalltalk.org/
    although there are other languages with related phrasing (like in
    HyperCard? and even COBOL?).
    My initial recollection was that Inform had this sort of syntax but a quick
    re-examination indicates otherwise:

    http://www.inform-fiction.org/manual/html/index.html
    http://www.inform-fiction.org/examples/index.html

    It has an interesting syntax, particularly for class and function definitions.

    David
  • Ryan Lowe at Aug 22, 2003 at 11:05 pm
    thanks for all the replies. i think the language i was thinking is lost
    amongst the hundreds of languages almost nobody has ever heard of. it doesnt
    really matter though, its the ideas that interest me. ive looked into so
    many languages recently, one thing is clear, ive only scratched the surface
    of different languages...

    i did look into some of the ones mentioned, specifically, COBOL and
    Applescript. i was more impressed with applescript, because i think you can
    expand the language that the interpreter understands (unlike COBOL) with
    some sort of 'dictionary,' though its a little hard to say at first glance,
    given the new-programmer-targeted documentation. it seemed a little wordy,
    like writing a sentence just to make an assignment when there is a perfectly
    good = sign for that :)

    "Paul D. Fernhout" <pdfernhout at kurtz-fernhout.com> wrote in message
    news:3f457487_7 at corp.newsgroups.com...
    You may be thinking of Smalltalk.
    http://www.smalltalk.org/
    although there are other languages with related phrasing (like in
    HyperCard? and even COBOL?).

    The Python code:

    x = sin(10) + 50 * 20 * self.myfunctionXY(cos(30), 40)

    would be in Smalltalk something like:

    x := 10 sin + (50 * 20 * self myfunctionX: 30 cos y: 40).
    i didnt look at smalltalk. stuff like this example turns me off a bit. why
    put the sin and cos AFTER the operand? ill try to look into it at some
    point, though. i have heard good things about it.
  • Sean 'Shaleh' Perry at Aug 23, 2003 at 5:38 am

    On Friday 22 August 2003 16:05, Ryan Lowe wrote:
    i did look into some of the ones mentioned, specifically, COBOL and
    Applescript. i was more impressed with applescript, because i think you can
    expand the language that the interpreter understands (unlike COBOL) with
    some sort of 'dictionary,' though its a little hard to say at first
    glance, given the new-programmer-targeted documentation. it seemed a little
    wordy, like writing a sentence just to make an assignment when there is a
    perfectly good = sign for that :)
    ah, but there is the rub. If '=' is good enough for assignment why bother
    with ANY english text? Why is:

    a = b

    better than

    assign b to a

    ?? (yes, this is a rhetorical question)
  • Paul D. Fernhout at Aug 24, 2003 at 2:33 am

    Roberto Amorim wrote:
    The Python code:

    x = sin(10) + 50 * 20 * self.myfunctionXY(cos(30), 40)

    would be in Smalltalk something like:

    x := 10 sin + (50 * 20 * self myfunctionX: 30 cos y: 40).

    In fact, that would be

    x := 10 sin + (50 * 20 * (self myfunctionX: 30 cos y: 40)).

    unless you want to call myfunctionX:y: over the result of (50*20*self). :-)
    My bad. Thanks for pointing this out. It somehow did feel wrong. Guess
    I've been doing too much Python these days. ;-)

    --Paul Fernhout



    -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
    http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
    -----== Over 100,000 Newsgroups - 19 Different Servers! =-----
  • Fahd Khan at Aug 27, 2003 at 12:03 am
    You could alias __getitem__ to "at" and word it as following, keeping
    entirely in the spirit of this thread:

    location = self stringCache at: string

    "Paul D. Fernhout" <pdfernhout at kurtz-fernhout.com> wrote in message news:<3f457487_7 at corp.newsgroups.com>...
    def addOrFindStringRecord: string readOnlyFlag: readOnlyFlag = 0
    if not readOnlyFlag
    self refreshLockFileIfNeeded
    self checkOpen
    if Options caching
    try
    if self stringCache has_key: string
    location = self stringCache[string]
    return self readStringIndexRecord: location
    except TypeError, e
    # may generate type error if object not hashable
    pass
    ...

    (Not sure what to do about brackets, so I left them...)
  • Mackstann at Aug 22, 2003 at 1:50 am
    Applescript has some interesting use of the English language.

    --
    m a c k s t a n n mack @ incise.org http://incise.org
    Avoid Quiet and Placid persons unless you are in Need of Sleep.
    -- National Lampoon, "Deteriorata"
  • Bob Gailer at Aug 22, 2003 at 3:55 pm

    At 12:39 AM 8/22/2003 +0000, Ryan Lowe wrote:
    disclaimer:
    this is a little out-there, primarily a thought excersise for myself. it
    probably belongs in group on programming language theory. but python got me
    thinking about this, so here it is. and dont worry, its NOT a change
    proposal.

    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 symbols dont save you much typing (especially if you count the
    shift key), but are merely something extra to learn and remember.
    Those of us who programmed in APL got great benefit from symbols. Not only
    did they save a LOT of typing they made it real easy to compose and read
    expressions. Consider (assuming A is a matrix of numbers):

    (+/A)%@A

    (in the APL font the % is a divide symbol (a - overstruck with a :) and the
    @ is the Greek letter rho.

    The pythonic equivalent is (Assuming A is a sequence of numbers):

    reduce(operator.add, A) / len(A)
    i also
    like how python did away with the unneccesary parentheses in for/if/while
    statements. soooo ive been toying with the idea of getting rid of parens in
    functions too (ive just been reading the ruby tut and noticed parens are
    optional in some cases which is cool, but trust me this is different)

    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
    since the arguments have an identifying word (with, b) (in, vtext), the
    order isnt important (other than the first 'anchor' word(s)), so we could
    instead have said:
    replace 'a' in vtext with 'b'
    or
    replace in vtext 'a' with 'b'
    ignoring that the last version is a little awkward to say, the advantage is
    immediate understandability; each parameter's contribution is explicitly
    stated so you dont have to guess or look up what each arg of a many-arg
    function does. of course, you could forget what words go in front of the
    args (e.g. was it 'in vtext' or 'from vtext'?), but since its english-like i
    think less so. plus an editor could give you hints like many do now.

    you may be thinking about keyword inflation. however, the parser would
    consider the whole set of words together, so the 'in' in the above wouldnt
    be bound to the meaning it has in a for statement. worst case scenario, a
    naming convention like the v in front of variable names could be used to aid
    parsing, but i think it may be possible to disambiguate without such a
    convention.

    i just want to say that i know i saw a similar idea in another language, a
    few years ago, but damned if i remember where or what language. i guess the
    language didnt make it:( but if anyone knows a language like this, PLEASE
    let me know.

    anyway, this is all well and good for this simple example, but lets see how
    it scales up. once you get familiar with finctions and dot syntax, you
    probably started chaining them together. it saves time and space and after
    not so long it becomes pretty easy to write and understand something like
    this:
    v = '/n'.join(file('file.txt').readlines()).lower().split('.')
    but think back to when all this stuff was new. you probably would have
    written:
    f = file('file.txt')
    v = f. readlines()
    v = '\n'.join(v)
    v = v.lower()
    v = v.split('.')
    it may be a little clearer, especially to a beginner, but its not nearly as
    convenient. now take a look at this:
    v = read lines from 'file.txt'; join it with '\n'; lower it; split it at
    '.'

    i showed this to a couple non-programmers, and they fould it much easier to
    interpret than the first way (i didnt show them the second way).
    Reminds me of showing others programs in languages they did not know.
    They'd say "I can't read that." Duh. And COBOL was famous for its verbose
    use of English to make programming easier.
    here i do introduce a new keyword 'it'
    new?? I assume you are unfamiliar with Apple's hypercard.
    which you can probably guess contains the
    return value of the statement to the left of the semicolon. you could add a
    'them' keyword for aggregates (as in the join part) if you are a grammar
    stickler.

    ill stop here before i put people completely to sleep. im curious what
    people think about this. im not concerned with 'minor' problems like the
    speed of a parser that could handle this. id like instead to hear comments,
    concerns, reguarding the theory. id especially like any links people might
    know about interesting experimental programming languages.


    --
    http://mail.python.org/mailman/listinfo/python-list


    ---
    Incoming mail is certified Virus Free.
    Checked by AVG anti-virus system (http://www.grisoft.com).
    Version: 6.0.506 / Virus Database: 303 - Release Date: 8/1/2003
    Bob Gailer
    bgailer at alum.rpi.edu
    303 442 2625
    -------------- next part --------------

    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system (http://www.grisoft.com).
    Version: 6.0.506 / Virus Database: 303 - Release Date: 8/1/2003
  • Jarek Zgoda at Aug 22, 2003 at 10:27 pm

    Ryan Lowe <ryanlowe0 at msn.com> pisze:

    v = read lines from 'file.txt'; join it with '\n'; lower it; split it at
    '.'
    Nice. Didn't COBOL come from similar assumptions? That a computer
    language should be as similar as possible to natural English?

    --
    Jarek Zgoda
    Registered Linux User #-1
    http://www.zgoda.biz/ JID:zgoda at chrome.pl http://zgoda.jogger.pl/
  • Tim Roberts at Aug 26, 2003 at 5:44 am

    "Ryan Lowe" 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. Pascal
    and Algol use the words or/and/not/is/in, as well as begin/end instead of
    {}.
    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
    You should check out REXX, the primary scripting language for OS/2. That
    line could have been taken from a REXX script practically unmodified.
    --
    - Tim Roberts, timr at probo.com
    Providenza & Boekelheide, Inc.
  • Christopher Barber at Aug 26, 2003 at 5:28 pm

    Tim Roberts <timr at probo.com> writes:

    "Ryan Lowe" 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
  • Ryan Lowe at Aug 28, 2003 at 10:33 pm
    "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" 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" 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.
  • Sean Ross at Aug 29, 2003 at 1:35 am
    "Ryan Lowe" <ryanlowe0 at msn.com> wrote in message
    news:3rv3b.6241$yg.2305230 at news4.srv.hcvlny.cv.net...
    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.
    Hi. I'm pretty sure you will not find a lot of support in this forum for
    changing
    Python in the way that your hoping. You're pretty much proposing a new
    language, not just enhancements for an existing one. But, whatever ...

    Personally, I really like the *idea* of an english-like programming
    language -
    I'd like to make one myself, and I think it'd be a fine toy for simple
    scripting.
    However, I also think it would become cumbersome as the scale of your
    projects grew. Heck, it's cumbersome even when your projects are small.
    English is not always the most concise way to say something, nor is it
    always the most clear. Take the following Applescript code for example:

    What is the result of each of these statements:

    words from paragraph 2 to paragraph 4
    words of paragraphs 2 thru 4
    text from paragraph 2 to paragraph 4
    text of paragraphs from 2 to 4

    They're all different.

    The answers can be found here:
    http://www.applescriptsourcebook.com/tips/gotchas/ranges.html

    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?

    In Applescript, you can (optionally) use parenthesis to (attempt to)
    disambiguate. So, for example, in your case, doing something like

    replace av with bv in (listv joined with gluev)

    might make things a bit clearer.
    i havent figured out how to de-dottify class functions and class
    attributes.
    Well, you could do something like this (applescript-like, again):

    -- If you have an instance of the class
    set the attribute of instance's class to value

    -- or
    set the attribute of the class of instance to value

    -- or, maybe even,
    get the attribute of instance's class
    set it to value


    -- And, if you don't have an instance, or you just want to get there
    directly
    set className's attribute to value



    Anyway. It's an interesting idea (your language) - not a new idea, but an
    interesting one. If you want to play around with something very much like
    Applescript, but you don't have a Mac, you can get a trial version of
    MetaCard (www.metacard.com). And, if you really want to make your own
    language, you could use SPARK, as a start, to whip up a (slow) prototype
    to mess around with and see how things should go together. As for getting
    Python to _become_ your language ... well, good luck with that.

    Sean
  • Ryan Lowe at Aug 29, 2003 at 11:29 pm
    "Sean Ross" <sross at connectmail.carleton.ca> wrote in message
    news:35y3b.3262$_F1.545316 at news20.bellglobal.com...
    "Ryan Lowe" <ryanlowe0 at msn.com> wrote in message
    news:3rv3b.6241$yg.2305230 at news4.srv.hcvlny.cv.net...
    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.
    Hi. I'm pretty sure you will not find a lot of support in this forum for
    changing
    Python in the way that your hoping. You're pretty much proposing a new
    language, not just enhancements for an existing one. But, whatever ...
    im not trying to change python. even a small change is a tough sell with
    this crowd ;-) i guess i should have labeled this off-topic. is there a
    forum that might be more appropriate?

    actually, i would like to make my own language, sort of. what id like to do
    is compile to regular old python code, instead of directly to executable.
    that way i wont have to reinvent the wheel for the parts of python i would
    keep in my new language (which is a lot), as well as all the libraries and
    such. maybe ill find this will become too difficult, but what the hell, i
    ought to learn a thing or two in the process.
    Personally, I really like the *idea* of an english-like programming
    language -
    I'd like to make one myself, and I think it'd be a fine toy for simple
    scripting.
    However, I also think it would become cumbersome as the scale of your
    projects grew. Heck, it's cumbersome even when your projects are small.
    English is not always the most concise way to say something, nor is it
    always the most clear. Take the following Applescript code for example:

    What is the result of each of these statements:

    words from paragraph 2 to paragraph 4
    words of paragraphs 2 thru 4
    text from paragraph 2 to paragraph 4
    text of paragraphs from 2 to 4

    They're all different.
    thats interesting. thats pretty much the impression i got from applescript.
    i think it goes too far trying to be english-like to the point of
    obfuscation. i see no need to english-ify selecting a range of things from a
    list.
    id do something like:

    get words in paragraphs[2 : 4]

    where paragraphs is a list of strings each containing a paragraph of text
    and "get words in _" is a function call and the *only* form it can be
    written (in verb form, that is; in noun form the only way would be "words
    got in _").

    so i can dodge this bullet, but running into the type of problem in this
    example is exactly what im concerned with. as it stands, i dont think the
    difference between my way and python's way is as different as between my way
    and applescripts.' i use function calls just like python, only they span
    multiple words with the args interspersed instead of bunched up at the end.

    part of my motivation for attempting this comes from my ongoing struggle to
    understand functional programming, which goes to the extreme of putting
    functions/operators in the wrong place vis a vis the arguments. so i guess
    my main point in asking here was to see if people with more oo and/or
    functional lang knowledge can find where/if my model breaks down. because,
    id like to build much more than a "toy" language.
    The answers can be found here:
    http://www.applescriptsourcebook.com/tips/gotchas/ranges.html

    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?

    In Applescript, you can (optionally) use parenthesis to (attempt to)
    disambiguate. So, for example, in your case, doing something like

    replace av with bv in (listv joined with gluev)

    might make things a bit clearer.
    sure thats the obvious solution. it would suck (just a little) if every
    expression-argument needed parens, while the comma and single outer parens
    work in traditional functions, but thats minor.
    i havent figured out how to de-dottify class functions and class
    attributes.
    Well, you could do something like this (applescript-like, again):

    -- If you have an instance of the class
    set the attribute of instance's class to value

    -- or
    set the attribute of the class of instance to value

    -- or, maybe even,
    get the attribute of instance's class
    set it to value


    -- And, if you don't have an instance, or you just want to get there
    directly
    set className's attribute to value
    or just
    attribute of classInstanceVar = value

    the 'of' works like the dot only in front. may conceivably cause problems if
    functions have ofs in them, but since it works on the front while other
    function words go behind, i think its resolvable.

    can anyone think of something you couldnt do with this, that you can in
    python? i know applescript is limited, but does my language suffer from
    similar challenges? any functions that would translate to a simple
    verb-noun-args and other words setup?
    Anyway. It's an interesting idea (your language) - not a new idea, but an
    interesting one. If you want to play around with something very much like
    Applescript, but you don't have a Mac, you can get a trial version of
    MetaCard (www.metacard.com). And, if you really want to make your own
    language, you could use SPARK, as a start, to whip up a (slow) prototype
    to mess around with and see how things should go together. As for getting
    Python to _become_ your language ... well, good luck with that.

    Sean
    SPARK, huh. never heard of it, ill check it out. thanks
  • Sean Ross at Aug 30, 2003 at 12:15 am
    "Ryan Lowe" <ryanlowe0 at msn.com> wrote in message
    news:ClR3b.22734$yg.8965558 at news4.srv.hcvlny.cv.net...
    [snip]
    im not trying to change python. even a small change is a tough sell with
    this crowd ;-) i guess i should have labeled this off-topic. is there a
    forum that might be more appropriate?
    I'm all for this kind of discussion. But, as to a more appropriate forum,
    I think comp.lang.misc would be the place for this type of thing.

    [snip]
    i see no need to english-ify selecting a range of things from a
    list. id do something like:

    get words in paragraphs[2 : 4]
    I'd do something like

    paragraphs[2 to 4].words

    myself.


    [snip]
    SPARK, huh. never heard of it, ill check it out. thanks
    Then you missed my earlier post to this thread: http://tinyurl.com/lnts

    There is code at my site, listed in that posting, that used SPARK to make
    a toy language based on the Python 1.5.2 grammar. It's not great, but you
    may find it instructive (atleast insofar as what things not to do :)

    You can prototype your language, work out the kinks, then consider
    whether to reimplement in C, or what ever.

    Good luck, and have fun.
    Sean

Related Discussions

People

Translate

site design / logo © 2022 Grokbase