Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't overwrite the users variables #6

Open
Tarrasch opened this issue Mar 9, 2013 · 9 comments
Open

Don't overwrite the users variables #6

Tarrasch opened this issue Mar 9, 2013 · 9 comments
Labels

Comments

@Tarrasch
Copy link
Owner

Tarrasch commented Mar 9, 2013

Currently, if a user of zsh-functional has the shell variable x defined, it'll be rewritten by some temporary value by the internals of zsh-functional.

@Tarrasch
Copy link
Owner Author

Example:

~  
❯ x=4

~  
❯ apply () { $2 $1 }

~  
❯ time eachf 'apply hi' $colors
hi
hi
hi
hi
hi
hi
hi
hi

~  
❯ echo $
$

~  
❯ echo $x
white

@swistak35
Copy link

Indeed. The same would be with go function, it took me some time to figure out what's wrong with my zshrc that map doesn't work. Maybe renaming functions for something like _funcs_x, _funcs_go?

@Tarrasch
Copy link
Owner Author

Tarrasch commented Sep 4, 2014

Well, it will not work for the variable x, after all the purpose is that you can use it it in the lambda expressions. However, it makes sense for the helper function go. Do you mind creating a PR for this? I would love to see another contributor (otherwise I'm fine with doing it.

I think the easiest solution for go is just to rename it to _zsh-functional_go. I think it's worth being explicit here. :)

By the way, I'm really grateful for finding this old issue, I should start fixing things for this project. :)

@swistak35
Copy link

Sure, I will do that. : )

@Tarrasch
Copy link
Owner Author

Tarrasch commented Sep 4, 2014

That's awesome! Just say if you want any help, and I have a complete test-suite as well, so don't be afraid that things might break. :)

@Tarrasch
Copy link
Owner Author

Tarrasch commented Dec 1, 2014

Argh, I just got bitten by this myself, I guess I should update my own software! :)

@NightMachinery
Copy link

@Tarrasch I don't see why we need x in lambdas? What's wrong with $1? Anyways, can't you use local x in the internals?

@Tarrasch
Copy link
Owner Author

What's wrong with $1?

I find it unintuitive. Also we want to highlight that we're dealing with "special" syntax.

Anyways, can't you use local x in the internals?

Maybe. I haven't touched this in a while. Do you mind trying it out? If so please remember test cases!

@NightMachinery
Copy link

NightMachinery commented Oct 22, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants