On 8/23/06, Philip Ganchev <[EMAIL PROTECTED]> wrote:
> On 8/22/06, Axel Liljencrantz <[EMAIL PROTECTED]> wrote:
> [...]
> > You would be able to do both always, since they provide the same
> > functionality. The main differences are in discoverability and ease of
> > use. Relevant points:
>
> I guess the only reason a builtin may be less discoverable than a
> variable is that there are much fewer variables (and that other shells
> use a variable).
>
> > * Fish uses a 'random' builtin instead of a $RANDOM varaible as bash
> > does, because it really is more a function than a variable (It changes
> > dynamically every time you use it, but always in the same order -
> > that's pretty far from how other variables work), and because I though
> > it would be easier to find out about a builtin than a function.
>
> By the way, is there a reason why "random" should not be an external
> program instead of a builtin?
>
> > * $history allows you to do neat things like array slicing because it
> > is an array  and fish has some pretty nice tools for manipulating
> > arrays.
> [...]
>
> I think you are saying that if "history" was a builtin, then using
> array splicing would be more verbose: ``set history (history); echo
> $history[2]``.  I guess this can be alleviated by using a hack like
> ``(history | get 2 4)``.  Of course, it would be nicer if
> ``(history)[2 4]`` worked.


I implemented command substitution slicing as per above. You can now
write 'echo (ls -S)[6]' to get the name of the largest file in the
directory. Just like array indices, negative indices are from the end,
so 'echo (ls)[-1]' means the name of the smallest file in the
directory. The patch is in the darcs tree if anyone wants to try it
out.

-- 
Axel

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to