On Wed, 16 Aug 2000, David L. Nicol wrote: > Anyone for generalizing "select" to a more general "with" keyword > which would operate on a limited hash and be syntactic sugar for > replacing all appearances of unqualified variables that match > the hash's keys with references into it? > > %record = loadrecord($studentID); > with %record { > print <<SPAM; > Dear $Name: > Your tuition is now due. Please send in a payment > of at least $Minumum. > > SPAM > > # anyone for having a python-like floating left edge for > # retaining indentation of hereis strings? > > }; I find myself very much of two minds...I think the like the general idea, but not the implementation. A couple of thoughts: 1) The keyword should not be "with". While that would make it more familiar to Pascal programmers, I don't feel that should be a major incentive to choose a suboptimal keyword and, IMHO, we can do better. I prefer "express"; it's a synonym of "import", and it seems descriptive...you are "express"ing the keys of your hash as new scalars. 2) "express" should guarantee that, before it creates a variable names $FOO, it first calls "local" on any existing $FOO 3) The new variables should be lexicals, defined only within the "express" block, so that you don't pollute your namespace. Dave
- Re: Default filehandles(was Re: command line option: $... Nathan Wiger
- Re: Default filehandles(was Re: command line option: $... Chaim Frenkel
- Re: Default filehandles(was Re: command line option: $... Jonathan Scott Duff
- Re: Default filehandles(was Re: command line option: $... Chaim Frenkel
- Re: Default filehandles(was Re: command line option: $... Nathan Wiger
- Re: Default filehandles(was Re: command line option: $... Chaim Frenkel
- Re: Default filehandles(was Re: command line option: $... Nathan Wiger
- Re: Default filehandles(was Re: command line option: $... Chaim Frenkel
- Re: Default filehandles(was Re: command line option: $... Peter Scott
- pascal-like "with" was Re: Default filehand... David L. Nicol
- Re: pascal-like "with" was Re: Default file... Dave Storrs
- Re: pascal-like "with" was Re: Default file... Johan Vromans
- Re: pascal-like "with" was Re: Default file... Dave Storrs
- Re: pascal-like "with" was Re: Default file... John Porter
- Re: pascal-like "with" was Re: Default file... Johan Vromans
- Re: pascal-like "with" was Re: Default file... Dave Storrs
- Re: pascal-like "with" was Re: Default fileh... Clayton Scott
- Re: pascal-like "with" was Re: Default fileh... Dave Storrs
- implied pascal-like "with" or "express&... David L. Nicol
- Re: implied pascal-like "with" or "expr... Jeremy Howard
- Re: implied pascal-like "with" or "expr... David L. Nicol