-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
User-configurable gensym
#178
Comments
Something simple like this should be sufficient: const internal_name_prefix = Ref{Symbol}(:_)
function make_internal_name(original_name::Symbol)
return Symbol(internal_name_prefix[], original_name)
end Example usage: julia> make_internal_name(:foo)
:_foo
julia> make_internal_name(:bar)
:_bar
julia> internal_name_prefix[] = :_internal_
:_internal_
julia> make_internal_name(:foo)
:_internal_foo
julia> make_internal_name(:bar)
:_internal_bar |
Thanks @DilumAluthge! Just to check, this does disallow Final concern is that we'll need this a lot, and |
Yeah I think it's fine to disallow gensyms. They make the code harder to read anyway.
|
Great point. At one point, Soss used to use
gensym
for new symbols. But for looking at the source code, this can be pretty confusing. So currently I'm using a leading underscore for "internal" variables. For example.Maybe a better way to do this would be to have a function
makename
(or something) that's user-configurable with some easy default. So currently it would be@DilumAluthge what's a sensible way to set this up so users can change it? Maybe as a
Ref{Function}
?Originally posted by @cscherrer in #176 (comment)
The text was updated successfully, but these errors were encountered: