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

less() and edit() are not defined for macros #3377

Closed
diegozea opened this issue Jun 13, 2013 · 7 comments
Closed

less() and edit() are not defined for macros #3377

diegozea opened this issue Jun 13, 2013 · 7 comments
Labels
good first issue Indicates a good issue for first-time contributors to Julia

Comments

@diegozea
Copy link
Contributor

julia> less( @b_str )
ERROR: wrong number of arguments

julia> less( b_str )
ERROR: b_str not defined

julia> less
# methods for generic function less
less(file::String,line::Integer) at util.jl:174
less(file::String) at util.jl:177
less(f::Function) at util.jl:181
less(f::Function,t) at util.jl:182
@JeffBezanson
Copy link
Member

Macros are not first class, so functions cannot be defined for them. We would need something like maybe @edit @b_str.

@simleb
Copy link

simleb commented Jun 13, 2013

On a related note, could edit on a type bring you to the line where the type was defined?

@mbauman
Copy link
Member

mbauman commented Dec 2, 2013

I just tried to do this myself as a novice user. Upon seeing the syntax error in less(@b_str), my gut reaction was to try less(:@b_str). There's a whole class of functions that interact with functions (help, less, edit, etc). Perhaps methods could be defined for Expr arguments that would allow interacting with macros as well? This could further allow for method specification (like @which) for functions.

@quinnj
Copy link
Member

quinnj commented Jun 10, 2014

@mbauman, with the rewrite of the less, edit, which methods/macros, can this be managed? I think having the ability to say @edit :@b_str would be a good way to expose this functionality; as you said, once you realize @edit @b_str doesn't work, it's natural to try the macro as a symbol.

@mbauman
Copy link
Member

mbauman commented Jun 10, 2014

It'd take much bigger changes for that to work. The way the @which et al macros work is through the first-class nature of the function objects and their stored meta-information. Macros are not first-class, and so they do not have this data.

This could be possible, perhaps, with the documentation changes.

@ihnorton ihnorton added the help wanted Indicates that a maintainer wants help on an issue or pull request label Jan 7, 2015
@ihnorton ihnorton added good first issue Indicates a good issue for first-time contributors to Julia and removed help wanted Indicates that a maintainer wants help on an issue or pull request labels May 8, 2015
JeffBezanson added a commit that referenced this issue Jan 4, 2016
fix #9627, fix #8846, fix #8701
helps #3377, but additional work is needed there
JeffBezanson added a commit that referenced this issue Jan 5, 2016
fix #9627, fix #8846, fix #8701
helps #3377, but additional work is needed there
JeffBezanson added a commit that referenced this issue Jan 5, 2016
fix #9627, fix #8846, fix #8701
helps #3377, but additional work is needed there
dhoegh pushed a commit to dhoegh/julia that referenced this issue Feb 28, 2016
…edit(:@time)`  and `@edit @time 1+1` plus the equivalent for `which` and `less`. `methods` can also check for macro methods as  `methods(:@time, Tuple{Any})`. The `@edit`, `@less` and `@which` do also check for method specialization of the macro.
dhoegh added a commit to dhoegh/julia that referenced this issue Feb 28, 2016
…edit(:@time)`  and `@edit @time 1+1` plus the equivalent for `which` and `less`. `methods` can also check for macro methods as  `methods(:@time, Tuple{Any})`. The `@edit`, `@less` and `@which` do also check for method specialization of the macro.
dhoegh added a commit to dhoegh/julia that referenced this issue Feb 29, 2016
…edit(:@time)`  and `@edit @time 1+1` plus the equivalent for `which` and `less`. `methods` can also check for macro methods as  `methods(:@time, Tuple{Any})`. The `@edit`, `@less` and `@which` do also check for method specialization of the macro.
dhoegh added a commit to dhoegh/julia that referenced this issue Mar 1, 2016
…, `@functionloc @time 1+1` plus the equivalent for `@which`, `@edit` and `@less`. The macros check for method specialization of the macro and return the dispatched macro.
dhoegh added a commit to dhoegh/julia that referenced this issue Mar 1, 2016
…, `@functionloc @time 1+1` plus the equivalent for `@which`, `@edit` and `@less`. The macros check for method specialization of the macro and return the dispatched macro.
dhoegh added a commit to dhoegh/julia that referenced this issue Mar 6, 2016
…ctionloc @time

1+1` plus the equivalent for `@which`, `@edit` and `@less`. The macros check for method specialization of the macro and return the dispatched macro. The `@functionloc` macro is exported and the documentation is updated.
dhoegh added a commit to dhoegh/julia that referenced this issue Mar 6, 2016
…ctionloc @time

1+1` plus the equivalent for `@which`, `@edit` and `@less`. The macros check for method specialization of the macro and return the dispatched macro. The `@functionloc` macro is exported and the documentation is updated.
dhoegh added a commit to dhoegh/julia that referenced this issue Mar 6, 2016
…ctionloc @time

1+1` plus the equivalent for `@which`, `@edit` and `@less`. The macros check for method specialization of the macro and return the dispatched macro. The `@functionloc` macro is exported and the documentation is updated.
dhoegh added a commit to dhoegh/julia that referenced this issue Mar 7, 2016
…ctionloc @time

1+1` plus the equivalent for `@which`, `@edit` and `@less`. The macros check for method specialization of the macro and return the dispatched macro. The `@functionloc` macro is exported and the documentation is updated.
dhoegh added a commit to dhoegh/julia that referenced this issue Mar 13, 2016
…ctionloc @time

1+1` plus the equivalent for `@which`, `@edit` and `@less`. The macros check for method specialization of the macro and return the dispatched macro. The `@functionloc` macro is exported and the documentation is updated.
dhoegh added a commit to dhoegh/julia that referenced this issue Apr 5, 2016
…ctionloc @time

1+1` plus the equivalent for `@which`, `@edit` and `@less`. The macros check for method specialization of the macro and return the dispatched macro. The `@functionloc` macro is exported and the documentation is updated.
elsuizo pushed a commit to elsuizo/julia that referenced this issue Apr 5, 2016
@dhoegh
Copy link
Contributor

dhoegh commented Jul 9, 2016

Bump somehow this did not get auto closed when #15282 was merged.

@yuyichao
Copy link
Contributor

yuyichao commented Jul 9, 2016

.... not even the PR was closed when I merge it with the merge butten .... #15282 (comment)

@yuyichao yuyichao closed this as completed Jul 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Indicates a good issue for first-time contributors to Julia
Projects
None yet
Development

No branches or pull requests

9 participants