Re: Re: names for init block keywords?
Mukhsein Johari <[email protected]>
| Newsgroups | gmane.comp.lang.prothon.user |
|---|---|
| Message-ID | <[email protected]> |
--- Mark Hahn <[email protected]> wrote: > Laurent Dube wrote: > > > About "init:", I don't see a confusion with init_, > as init_ > > is a method at the object level, and "init:" > designates a > > block inside a function. > > Duh! I don't know how I confused the two. I even > remember writing some > code somwhere like this which should be impossible. > I'll have to find > that example and remove it before it embarrases me. > :-) > > def func(): > defInit: > blah lah blah > def init_(): > blah blah blah > > Ok, I'll go for "init:". You aren't the first to > suggest it. "outer:" > seems like a winner also. > I think init: is confusing. How about initial: ? I'd prefer something like onFirstCall: but that might be too long for a keyword. This keyword should be on that reinforces the idea that the following block is run on the first call only. (for original as well as inheritor code maintainers, not to mention newbies) On a related note, from the wiki: ------------------------------------- def f(x,y,z): """f is a long boring function""" outer: f = resCache(logger(f), cacheSize = 500) blah blah blah <pre> This would be functionally identical to ... <pre> def f(x,y,z): """f is a long boring function""" blah blah blah f = resCache(logger(f), cacheSize = 500) --------------------------------------- If the two are equivalent, why add the uneeded sugar? What's wrong with just doing the latter? Isn't it clearer that you're actually executing code as opposed to defining in the latter as opposed to the former? The outer: block looks (at a glance) like a definition or declaration like the rest of that def block. Please lets try to keep prothon lean? Pretty please? ________________________________________________________________________ Yahoo! Messenger - Communicate instantly..."Ping" your friends today! Download Messenger Now http://uk.messenger.yahoo.com/download/index.html