Closed PossiblyAShrub closed 4 months ago
This is ready for a review.
This is ready for another review.
Btw, I did find that my changes have this behavior:
$ hello() {
> echo hello
> }
$ var hello = 'hi'
$ hello
"hello"
I'm not sure if this is what we want to do here. Should this be correct?
This is ready for another review.
Btw, I did find that my changes have this behavior:
$ hello() { > echo hello > } $ var hello = 'hi' $ hello "hello"
I'm not sure if this is what we want to do here. Should this be correct?
OK I guess what's happening is that
Hm I guess the exact rules are up for debate ...
You could argue that if the name is found in the var namespace, it could show an error "not a proc"
This would possibly have some annoying consequences like:
var ls = 42
ls # external ls should still work ???
I don't think the behavior you showed is bad though, I guess because it doesn't make sense to call the string "hi" anyway
I think we can leave it as is for now, and perhaps iterate
I think we can leave it as is for now, and perhaps iterate
Sounds good.
Are there any other blockers on this PR before we merge?
Looks good, thanks!
I merged, though now that I think about it, if Del()
is only for sh_funcs
, then I think GetNames()
should be too
I think we should change declare -F
and compgen -A function
to only list shell functions
procs are now something "different" ... I think we might have compgen -A proc
and so forth
Actually declare -F
like is dir()
! I remember I wanted to write a blog post about how I used dir()
and getattr()
to learn Python, not reading the docs
We want that property too
It also reminds me that our object model is too weak ... maybe we should be able to have
getVar()
and so forthIf you agree about excluding procs out of GetNames(), please send a follow-up
I am also thinking of things about our "meta-object model", like Python has
__call__
__dir__
(I think)__get__
and __getattr__
I think we might want something like __invoke__
All these things can be "invoked" like a command:
Supersedes: #2025
Redoing the implementation now that we know more about the design and possible issues.