On 22/09/06, Philip Ganchev <[EMAIL PROTECTED]> wrote:
> On 9/21/06, Beni Cherniavsky <[EMAIL PROTECTED]> wrote:
> > A builtin whose only purpose is accessing something which is
> > essentially an array means two interfaces to a single concept.  It
> > violates the law of orthogonality.  Unless someone has good arguments,
> > history should be just an array.
>
> I think the history is conceptually a builtin, because you can't set
> it (and should not be able to).  If possible, all variables should be
> settable, to keep things conceptually simple.
Why shouldn't I set it?  Sure, I can lose my history if I don't know
what I'm doing.  But it allows implementation in fish of powerful
things like synchronizing your history accross multiple computers.
The fact that we don't have a good use case doesn't mean nobody wants
to set it.  Otherwise, why isn't make ~/.fish_history read-only too?

> Sure, the output is an
> array.  You can always access the n-th element using ``(history)[n]``,
> so the cost in terms of verbosity is negligible.
>
Granted.  Though I'm slightly afraid the performance of
``(history)[n]`` will deteriorate as the history grows.

> I would think that ``history`` as a builtin is also more discoverable,
> because you don't need to type a dollar-sign to access it.
> ``history`` on its own can shorten the output (as with ``set``) to the
> last few commands.  You can't do that with a variable.  (You can pass
> the text to be shortened to a "shorten" function: ``echo $history |
> shorten``.)
>
OK, these are good arguments.

> >[implementation of yank-last-arg]
> >
> What's the benefit of this over using Fish's Alt-uparrow?
>
Hey I never noticed, Alt-up!  No benefit.  Thanks a lot, you have
removed the one productivity benefit bash had over fish for me!  (I
think I used M-. more than any other key in bash).
I think I'll write a bash->fish migration tutorial soon.

OK, I no longer have a personal use case for
$__fish_last_edit_command.  It might still useful but I'm starting to
think a mechanism for defining new move-through-a-list pairs of
commands (like up/down, alt-ap/down, alt-left/right) can subsume all
its uses more conveniently.  Let's wait until we have use cases for
commands we would like to add (or convert from builtins to functions).

-- 
Beni Cherniavsky <[EMAIL PROTECTED]>, who can only read email on weekends.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to