Re: Py Update

new topic     » goto parent     » topic index » view thread      » older message » newer message

Great work David.
Seeing its still in alpha-mode, can I suggested a change or two?

Allow the programmer to decide whether or not to allow automatic creation of
variables. Some programmers like variables to be created automatically and
others believe that this is another source of potential bugs.

My personal preference is to have to declare variables before they can be
referenced. This way I can catch all my spelling mistakes.

If I coded the following function this way, it would always fail, simply
because I misspelt the return name.

def find_match( list, key )
    matches = 0
    for item in list do
        if key = item then
            matches += 1
        end if
    end for
    return matchs
end def

So how about a language directive like one finds in MS Basic "option
explicit".

And how about allowing a "while" clause in the "for" statement.

    -- See if there is at least 5 items greater than 4.
    for item in list
       while item > 4 and matches < 5
    do
        if key = item then
            matches += 1
        end if
    end for


------
Derek Parnell
Melbourne, Australia
(Vote [1] The Cheshire Cat for Internet Mascot)

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu