Skip to content

Redefined set without scope shadowing is not completely transparent. #1046

Closed

Description

@sugar700

Following code doesn't work.

~ $ fish -c 'function set --no-scope-shadowing; builtin set $argv; end; type type'
test: Missing argument at index 2
type: Could not find 'type'

Activity

  1. zanchey commented on Oct 22, 2013

    @zanchey
    Member

    The errors occur because when you set a local variable using your function, it does not actually get set in the current local scope - it only gets set inside the function local scope.

    fish -c 'function set --no-scope-shadowing; builtin set $argv; end; set -l some arg; echo $some'

    produces no output.

  2. added this to the milestone on Oct 5, 2014
  3. krader1961 commented on Mar 23, 2017

    @krader1961
    Contributor

    This is still broken although the failure mode appears to have changed:

    switch: Expected exactly one argument, got 0
    
    /usr/local/share/fish/functions/type.fish (line 17):                 switch $flag
                                                                                ^
    in function 'type'
    	called on standard input
    	with parameter list 'type'
    
    switch: Expected exactly one argument, got 0
    
    /usr/local/share/fish/functions/type.fish (line 27):                 switch $flag
                                                                                ^
    in function 'type'
    	called on standard input
    	with parameter list 'type'
    
    test: Missing argument at index 2
    
  4. krader1961 commented on Mar 23, 2017

    @krader1961
    Contributor

    I just realized this is a duplicate of issue #3540.

  5. locked as resolved and limited conversation to collaborators on Apr 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions