I do think it would be a good thing to fix, however. It's just not as pressing as other issues.
On Tue, Jun 3, 2014 at 10:25 PM, Jameson Nash <[email protected]> wrote: > adding a type declaration to a global const is not really necessary. since > you've already told the compiler that the value can't change, it is > redundant to tell it that the type of that value also can't change. > > and since the use of globals is discouraged anyways, it hasn't ended up > being too much of an issue, and has been very low priority to address this > parser/implementation quirk > > > On Tue, Jun 3, 2014 at 10:17 PM, Andrew Simper <[email protected]> > wrote: > >> On Wednesday, June 4, 2014 12:13:30 AM UTC+8, Mauro wrote: >> >>> >>> However, there are some subtleties, have a look at the manual >>> http://docs.julialang.org/en/latest/manual/types/ >> >> >> On Wednesday, June 4, 2014 9:52:01 AM UTC+8, Andrew Simper wrote: >>> >>> Is there some obscure reason that the global scope is somehow special >>> when it comes to handing the types of variables? >>> >>>> >>>> >> Ahh, ok, I have found the small print, thanks for posting that link: >> >> "Currently, type declarations cannot be used in global scope, e.g. in the >> REPL, since Julia does not yet have constant-type globals. " >> >> Ok, so it sounds this case hasn't been handled yet, fair enough it is >> only v0.3.x and already super useful, and most practical applications I'll >> be writing functions to call anyway. But I think it would make sense even >> if just done for consts since that is already supported at the global level: >> >> From the page: >> >> http://julia.readthedocs.org/en/latest/manual/variables-and-scoping/#constants >> >> "The const declaration is allowed on both global and local variables, >> but is especially useful for globals. It is difficult for the compiler to >> optimize code involving global variables, since their values (or even their >> types) might change at almost any time. If a global variable will not >> change, adding a const declaration solves this performance problem." >> >> Which is a little confusing when this sort of thing goes on: >> >> >> <https://lh3.googleusercontent.com/-FrXH_N3Ewas/U46BaHI0hXI/AAAAAAAAAM8/iUT1CLKK1eg/s1600/Screen+Shot+2014-06-04+at+10.15.08+AM.png> >> >> >> >> >> >> >
