[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Read?
> please comment on the proposed semantics. possible variations:
> + not including any such builtin and dropping the idea entirely
This is what I think, you've got ``line'' already, and if not, you could use
``awk'' etc. to do simple line oriented input. I was one of these people who
proposed an integer-math builtin, but I've come to the conclusion that there
are other tricks that circumvent the use of it in most cases (c.f. the
recently posted repeat command), despite having already written one myself.
Well if we are going to have %read, here are my comments on the proposals:
> + don't strip the trailing newline
> + don't hardcode the line delimiter as \n
I like the idea of a variable delimiter, then you could have multi-line
input. I think this is an advance over ``line'', so maybe it could justify
the builtin. If you allow this variable delimiter, I think it would be nice
to have the option of keeping it, but as Harald pointed out, it's not too
easy to remove the last char from the input, without doing several (possibly
long) list assignments (if you're using builtins only). As it's the last
char, it's easier to add it on the add then having to remove it using
builtins.
> + let %read take a prompt argument, ala %parse
This is quite nice, but I suppose ``echo -n'' will do.
> + use readline/editline if appropriate
Fine.
Pete.