Live data from Hacker News

Show HN: Lisp Shell

github.com

41–50 of 61 posts

Re: Show HN: Lisp Shell

#41

Earlier quoted context omitted.

Thanks! I implemented this just to create blank files, and didn't bother researching correctness. That's exactly the kind of correction I was hoping for when posting to HN. My first post too.

Another minor issue: cd without arguments should switch to the home directory rather than display the current directory (as your Readme suggests you do). You already have pwd for displaying the current directory.

'cd' is generally a shell built-in (even with Bash) rather than a forked command so I think it's fair if shell writers want to break the mold with that particular function. It's like how the shell built-in versions of 'echo' usually differ from /bin/echo (same for 'time' as well).

So in that regard I don't think it's fair to compare 'cd' to 'cat' nor 'touch' where people will be used to the GNU / whatever coreutils.

Re: Show HN: Lisp Shell

#42
post #41

Earlier quoted context omitted.

Another minor issue: cd without arguments should switch to the home directory rather than display the current directory (as your Readme suggests you do). You already have pwd for displaying the current directory.

'cd' is generally a shell built-in (even with Bash) rather than a forked command so I think it's fair if shell writers want to break the mold with that particular function. It's like how the shell built-in versions of 'echo' usually differ from /bin/echo (same for 'time' as well). So in that regard I don't think it's fair to compare 'cd' to 'cat' nor 'touch' where people will be used to the GNU / whatever coreutils.

I don't understand your argument at all. Whether something is a builtin or not is an implementation detail. 'cd' actually can't be anything but a builtin.

The behavior of 'cd' is defined by the Posix standard (in spite of it needing to be a builtin). Now, you're welcome to care or not about that. But there's no reason to make that decision inconsistently for 'cd', 'cat' and 'touch'.

Re: Show HN: Lisp Shell

#43
post #22

Earlier quoted context omitted.

With the major caveat that piping commands together doesn't work that well, eshell has been an amazingly useful feature of emacs for me. Combined with TRAMP support, it makes dealing with remote machines much much more friendly. As an example, "cd 'ssh:firstmachine|ssh:secondmachine:/'" works just like you would anticipate, bounces you through first machine to second machine. All commands from that point are executed…

> Even better, "cp someFile ~/" will transmit a file back to my local machine so that I don't have to work with the scp commands that it requires. Did not know that. That’s a neat trick! Do feel free to share more if you have any :)

Don't really have much else. I do have "M-x g" bound to "magit-status" so that as long as my PWD is in a repository, no matter if it is remote or not, I get my git status buffer. That didn't really require any setup, though. Magit already "does the right thing" if you are on a remote machine.

I did have to add a lot to my tramp path. Can't remember why, right off. I just know that it helps find a lot of things that don't make the standard path for some reason.

Re: Show HN: Lisp Shell

#44
post #41

Earlier quoted context omitted.

'cd' is generally a shell built-in (even with Bash) rather than a forked command so I think it's fair if shell writers want to break the mold with that particular function. It's like how the shell built-in versions of 'echo' usually differ from /bin/echo (same for 'time' as well). So in that regard I don't think it's fair to compare 'cd' to 'cat' nor 'touch' where people will be used to the GNU / whatever coreutils.

I don't understand your argument at all. Whether something is a builtin or not is an implementation detail. 'cd' actually can't be anything but a builtin. The behavior of 'cd' is defined by the Posix standard (in spite of it needing to be a builtin). Now, you're welcome to care or not about that. But there's no reason to make that decision inconsistently for 'cd', 'cat' and 'touch'.

> I don't understand your argument at all.

My point being shell builtins can and often do differ from one shell to another.

> Whether something is a builtin or not is an implementation detail.

You could argue that but I think it goes a little beyond purely implementation detail. A builtin is often a builtin because it fits the shell idiom better than having a forked command. eg `time` wouldn't work well if you had to put the command you want timed in quotation marks; which is one of the reasons Bash includes it's own `time` function as a builtin despite `/bin/time` being arguably more powerful (there are other reasons but I feel this is going to be a lengthy reply and `time` vs `/bin/time` is already well documented online anyway)

Thus if this shell's idiom is simplicity over features then it makes some sense not to follow Bash's convention for `cd`. In fact if I can use myself as an example; I have also written my own shell I didn't follow Bash's convention for `cd` either (which means I'm also aware `cd` cannot be anything other than a built in :P) The reason I broke compatibility with `cd` was because I wanted historic directories in a stacked array by default; I don't support `pushd` / `popd` because `cd` does it right out of the box. The historic variable holds the previous directories in a JSON array and that better fits the idioms of my shell because my shell is designed around natively munging data structures such as JSON. Thus my builtins should also follow the same idioms as the rest of the shell regardless of whether that breaks POSIX compliances or not.

> The behavior of 'cd' is defined by the Posix standard (in spite of it needing to be a builtin).

In case you hadn't noticed, this isn't a POSIX shell. There's no law stating every $SHELL has to be POSIX compliant and in fact a lot are not; including Bash itself. So your point about POSIX compliance is not relevant here at all as if you want a fully POSIX compliant shell then you should be looking elsewhere.

> Now, you're welcome to care or not about that. But there's no reason to make that decision inconsistently for 'cd', 'cat' and 'touch'.

Again I feel the need to reiterate the point that one runs a different shell because they lean towards a different idiom. So with that regard there is every reason to make a decision for breaking standards on `cd` if those standards don't conform to your shells own idioms. Otherwise what the hell is the point of running an alternative shell?

I feel `cat` and `touch` are exceptions to this rule because they are traditionally forked. I mean by all means the author is welcome to re-implement some of coreutils as well if they wish (ala Busybox) but I personally feel that is a step too far in shell design (excluding for a moment my previous example of Busybox as that is clearly intended as a one stop shop and is very useful in that regard!). I think the saner approach if you want to offer alternative functions to coreutils is to offer alternative builtins (eg `lcat` for "Lisp cat"). However that is my personal preference and if this particular shells author wants to reimplement coreutils for whatever reason they choose then I wish them luck. If nothing else, it will teach them a new appreciation for GNU et al coreutils.

Re: Show HN: Lisp Shell

#45
post #44

Earlier quoted context omitted.

I don't understand your argument at all. Whether something is a builtin or not is an implementation detail. 'cd' actually can't be anything but a builtin. The behavior of 'cd' is defined by the Posix standard (in spite of it needing to be a builtin). Now, you're welcome to care or not about that. But there's no reason to make that decision inconsistently for 'cd', 'cat' and 'touch'.

> I don't understand your argument at all. My point being shell builtins can and often do differ from one shell to another. > Whether something is a builtin or not is an implementation detail. You could argue that but I think it goes a little beyond purely implementation detail. A builtin is often a builtin because it fits the shell idiom better than having a forked command. eg `time` wouldn't work well if you had to…

There's no law stating every $SHELL has to be POSIX compliant... one runs a different shell because they lean towards a different idiom.

I absolutely encourage that! I accepted that possibility in my comment. See the kind of stuff I build: https://github.com/akkartik/mu. I introduced Posix purely as an example that builtins are as subject to standardization as coreutils.

Other than clarifying that I'll agree to disagree. It's great to rethink a shell from the ground up. If you're doing that, what earlier shells happen to choose as a builtin is an irrelevant signal. Depending on how you design your idioms, it may make sense to override stuff from coreutils as builtins. As you've pointed out, such overriding has already happened in bash and other shells.

These are all artificial boundaries to be questioned. Decide what behavior you want to copy and what you want to rethink regardless of where you find it.

Re: Show HN: Lisp Shell

#46
post #44

Earlier quoted context omitted.

> I don't understand your argument at all. My point being shell builtins can and often do differ from one shell to another. > Whether something is a builtin or not is an implementation detail. You could argue that but I think it goes a little beyond purely implementation detail. A builtin is often a builtin because it fits the shell idiom better than having a forked command. eg `time` wouldn't work well if you had to…

There's no law stating every $SHELL has to be POSIX compliant... one runs a different shell because they lean towards a different idiom. I absolutely encourage that! I accepted that possibility in my comment. See the kind of stuff I build: https://github.com/akkartik/mu . I introduced Posix purely as an example that builtins are as subject to standardization as coreutils. Other than clarifying that I'll agree to disa…

Sorry but now it's my turn to not understand the point raised. Are you arguing that people should be allowed to explore other options outside of POSIX compliance but except in this specific case?

It's pretty clear this shell isn't intended to follow in the footsteps of Bash, let alone be fully POSIX compliant, so I don't really understand why you are comparing it to them in terms of compatibility (and even more confused now that you've said you encourage people breaking POSIX).

Or is the point you're raising a question of what should be a builtin and what should not?

(happy to agree to disagree by the way; but I'm just a little confused as to what we are disagreeing about :))

Re: Show HN: Lisp Shell

#47
post #46

Earlier quoted context omitted.

There's no law stating every $SHELL has to be POSIX compliant... one runs a different shell because they lean towards a different idiom. I absolutely encourage that! I accepted that possibility in my comment. See the kind of stuff I build: https://github.com/akkartik/mu . I introduced Posix purely as an example that builtins are as subject to standardization as coreutils. Other than clarifying that I'll agree to disa…

Sorry but now it's my turn to not understand the point raised. Are you arguing that people should be allowed to explore other options outside of POSIX compliance but except in this specific case? It's pretty clear this shell isn't intended to follow in the footsteps of Bash, let alone be fully POSIX compliant, so I don't really understand why you are comparing it to them in terms of compatibility (and even more confu…

Best kinds of conversations :)

Set aside my mention of POSIX as a minor point. My basic claim is this: building a whole new shell is an ambitious act. Whether your goal is to create a better experience for others or just learn new skills, restricting yourself to what earlier shells happen to consider to be builtins is limiting ambition. Be more ambitious and rethink as much as you want.

I'm not saying you have to rethink everything all at once all the way up from machine code (though I'm sympathetic to and experienced in that particular failure mode ^_^). I'm saying if you have an idea to improve 'cat' to fit better with your new shell, the fact that it's in coreutils shouldn't cause you pause. Who cares if it's a builtin in bash or not? Make it a builtin in your shell.

Re: Show HN: Lisp Shell

#48
post #46

Earlier quoted context omitted.

Sorry but now it's my turn to not understand the point raised. Are you arguing that people should be allowed to explore other options outside of POSIX compliance but except in this specific case? It's pretty clear this shell isn't intended to follow in the footsteps of Bash, let alone be fully POSIX compliant, so I don't really understand why you are comparing it to them in terms of compatibility (and even more confu…

Best kinds of conversations :) Set aside my mention of POSIX as a minor point. My basic claim is this: building a whole new shell is an ambitious act. Whether your goal is to create a better experience for others or just learn new skills, restricting yourself to what earlier shells happen to consider to be builtins is limiting ambition. Be more ambitious and rethink as much as you want. I'm not saying you have to ret…

Ahh in that case I completely agree with you :)
Post reply on HN