-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Deprecate Euler number e in favor of ℯ (U+212F) #10612
Conversation
Would be nice if, e.g., |
Yeah, but I'm not sure how to do that. |
With this commit, it looks like the deprecation warning is printed every time, not only on the first call. What am I doing wrong? |
As someone who has been teaching students to use Julia as a first language, I hope this doesn't go through. It is a much greater hurdle for a beginner to either define |
There's still |
Me too, please don't do this. I don't even know how to write the manuscript 'e'. Honestly I've seen about the Unicode variables but for me they are a 'nice curious thing' that I never really cared about and should never made mandatory in any case. |
|
There's nothing preventing anyone from using julia> e = 12345
12345
julia> e^2
152399025
julia> eu^2
7.38905609893065 Of course, if you try to use it both as julia> e
e = 2.7182818284590...
julia> e = pi
Warning: imported binding for e overwritten in module Main
π = 3.1415926535897...
julia> e
π = 3.1415926535897... |
Out of packages I have installed, LibExpat, Dates, ImmutableArrays, Graphs, StatsBase, DataArrays, WinRPM prior to JuliaPackaging/WinRPM.jl@41c6532, GZip, BloomFilters, Tk, HDF5, BinDeps, DataFrames, an old version of FactCheck, Distributions, Winston, IJulia, Gadfly, and Debug all use |
Perhaps there be a MathConsts module that isn't imported by default, but can easily switched on? I see the appeal of having instant access to |
Kind of off topic, but it would be great if there was a way to force tab complete to show all possible completions (starting with e), e.g. |
@hayd, in the console REPL, at least, you can hit |
@kmsquire I don't think that's the case if it's already a complete unicode name. Silly example (I can't recall the more annoying case I was dealing with recently, where this occured much earlier), I'm trying to tab complete to equivDD, but
Or, more annoyingly, I know it starts with c...
|
@tkelman that kind of sounds like a bug, either in the macro expander or one of the macros themselves. Saying that a certain piece of code --- even Base --- should avoid a certain variable name should not be necessary for sane scoping.
|
I would be OK with MathConsts not being imported by default. Also OK with eu as the name. |
This reduces confusion with variables called e, and ℯ is the Unicode character for "natural exponent". It also makes this constant more similar to others, which have both a "special letter" and longer ASCII form. Also add a tab replacement rule for \e.
Updated with the I've been able to fix the problem of repeated deprecation warnings for most cases, except when calling |
Are there actually sources for the wiki claim that "U+212F ℯ script small e" is somehow related to "natural exponent"? This would contradict ISO 80000-2. |
@mschauer Any copy of the Unicode standard will do, e.g. http://unicode.org/charts///PDF/Unicode-4.1/U41-2100.pdf It's true that ISO 80000-2 uses |
+1: e is one of the less useful constants for numerical software, since its main use is I would also be in favour of ⅈ (u+2148) for |
@nalimilan Ok, not our problem ;-) |
This will also help with things like:
|
Not really – that still means the same thing, regardless of whether |
Yes, but now at least one will throw an error (unless the user defines |
Both In practice you don't save much in terms of clarity when exponentiating a long expression, since you'd have |
As everybody probably knows, I'd rather have |
Obligatory reference to #5840. |
FWIW, I'm in favor of being consistent here. If Again, it's possible to work around whatever decisions are made here, but absent a policy that one can reference when deciding whether or not a specific single-character variable makes sense or not, it's confusing as heck. It's also entirely possible that I'm missing the point. |
I think what's happening here is that we don't want to add any more 1-letter exported names, but it's not worth breaking things to remove the few we have. |
Do we know how many people are actually using |
There is also a question of how strongly associated the letter is. Walk into any technical department and say "e", and it can mean only one thing. Most single letters have marginal meanings by comparison, I think even the |
OK, but then what about ζ? Heck, even the function declared in Base is named "zeta". My original proposal was to give it the corresponding unicode Greek letter. Again, I think it's more important at this point to be consistent. I'm not in favor of saying "we don't want to break things" in a language this new. IMO, consistency is more important than stability at this point in Julia's development. |
I'd say I'm not sure why we have |
As a quick datapoint from my entirely unscientific survey of all the packages I have installed, there were about 120 uses (multiple uses in the same function/file not counted) of e as local variables, 7 global redefinitions of
Only to get in my log file "An error occurred: 2.7182818284590...", being confused for a moment and then realizing what happened, I just don't think reserving the one character name is worth it. In the |
@Keno Thanks for actually doing that survey! |
Yes, that is interesting. I think this is more a command line thing than a package thing. Most real code will not use |
I like the suggestion above of putting these in a |
Without wanting to bikeshed the name, +1 to the |
FWIW, I most commonly use |
Since it doesn't seem this is going to be merged, could somebody knowledgeable review the docs I wrote in beea5bc and confirm they are good to merge separately? |
I haven't messed with |
I still feel strongly that this should be merged. We should think of this is deprecating e in favor of |
superseeded by #23427 |
The posthumous victory of an old and forgotten PR! |
This reduces confusion with variables called e, and ℯ is
the Unicode character for "natural exponent". It also
makes this constant more similar to others, which have
both a "special letter" and longer ASCII form.
Cf. #10607
Reference : http://en.wikipedia.org/wiki/Numerals_in_Unicode#Characters_for_mathematical_constants
(Shortest branch name ever!)