Re: [julia-users] Re: Why does the following give an error: p = 1; 2p+1 ??

2015-01-05 Thread Hans W Borchers
Oh, right. I now see the same behavior in Matlab. Never went into this trap -- probably because I was always using commas in array constructions. Unfortunately (for me), there is a difference with these two spellings in Julia. On Monday, January 5, 2015 11:47:25 PM UTC+1, Stefan Karpinski wrote:

Re: [julia-users] Re: Why does the following give an error: p = 1; 2p+1 ??

2015-01-05 Thread Jeff Bezanson
Yes, we should try to restrict parsing of hex float literals more if we're going to keep them. The `p` should only be special after 0xd.d... In fact, I didn't notice before that this is actually a simple bug in the parser. `2p+1` gives an internal error. That needs to be fixed in any case. On Mon

Re: [julia-users] Re: Why does the following give an error: p = 1; 2p+1 ??

2015-01-05 Thread Stefan Karpinski
Splitting expressions inside of array syntax is space sensitive as well: julia> [1 + 2] 1-element Array{Int64,1}: 3 julia> [1 +2] 1x2 Array{Int64,2}: 1 2 Of course this bothers me too, but it's another example of space-sensitivity.. On Mon, Jan 5, 2015 at 5:42 PM, Hans W Borchers wrote: >

Re: [julia-users] Re: Why does the following give an error: p = 1; 2p+1 ??

2015-01-05 Thread Hans W Borchers
Style guides are not syntax rules. Every body writes n+1 at times. Is there any other place in Julia where putting spaces (or not putting spaces) around arithmetical operators makes a difference? Would this be allowed by the general Julia philosophy? Will it not lead to errors very difficult to t

Re: [julia-users] Re: Why does the following give an error: p = 1; 2p+1 ??

2015-01-05 Thread Stefan Karpinski
I would also be sad to see hex literals go, and I've found the binary literals quite nice. Octal literals can go jump in a lake (the only real use case is for specifying permissions). On Mon, Jan 5, 2015 at 5:34 PM, Simon Byrne wrote: > On Monday, 5 January 2015 20:13:51 UTC, Jeff Bezanson wrote

Re: [julia-users] Re: Why does the following give an error: p = 1; 2p+1 ??

2015-01-05 Thread Simon Byrne
On Monday, 5 January 2015 20:13:51 UTC, Jeff Bezanson wrote: > > Hex float literals are a different story. It's an understatement to > say they are VERY rarely used, and that most programmers don't need > them and have never heard of them. They also don't currently work > under MSVC (issue #6349

Re: [julia-users] Re: Why does the following give an error: p = 1; 2p+1 ??

2015-01-05 Thread Jeff Bezanson
Already there: #6770 On Mon, Jan 5, 2015 at 4:27 PM, Tim Holy wrote: > On Monday, January 05, 2015 08:15:03 AM Hans W Borchers wrote: >> By the way, has the bug x = 10; x.1 returning 1.0 been handled in 0.4? It's >> still there in 0.3. > > Nope. If you haven't filed an issue already, please do. >

Re: [julia-users] Re: Why does the following give an error: p = 1; 2p+1 ??

2015-01-05 Thread Tim Holy
On Monday, January 05, 2015 08:15:03 AM Hans W Borchers wrote: > By the way, has the bug x = 10; x.1 returning 1.0 been handled in 0.4? It's > still there in 0.3. Nope. If you haven't filed an issue already, please do. --Tim > > On Monday, January 5, 2015 2:32:00 PM UTC+1, Simon Byrne wrote: >

Re: [julia-users] Re: Why does the following give an error: p = 1; 2p+1 ??

2015-01-05 Thread Jeff Waller
The cause for this thread is mainly a lexical analyzer bug for hex notation. Except for the error in #9617, I'm fine with the current behavior and syntax even with the semi e-ambiguity if you want the scientific notation literal, use no spaces. This is only ambiguous because Julia permits a nu

Re: [julia-users] Re: Why does the following give an error: p = 1; 2p+1 ??

2015-01-05 Thread Jeff Bezanson
Yes, sometimes saving one character is a big deal. It also allows editors to color them as numbers. But this is a minor point. For something as marginal as hex float literals, custom string literals are fine. On Mon, Jan 5, 2015 at 3:21 PM, Jason Merrill wrote: > On Monday, January 5, 2015 12:13:

Re: [julia-users] Re: Why does the following give an error: p = 1; 2p+1 ??

2015-01-05 Thread Jason Merrill
On Monday, January 5, 2015 12:13:51 PM UTC-8, Jeff Bezanson wrote: > > We might be able to find a more scalable syntax for different types of > numbers. For example the syntax x@000 is available; `@ then digit` is > always a syntax error currently. > Compared to a custom string literal (e.g. he

Re: [julia-users] Re: Why does the following give an error: p = 1; 2p+1 ??

2015-01-05 Thread Jeff Bezanson
My take on this is that 3e+1 has become a standard notation for numbers in programming languages. I'm comfortable having that as an exception to the concise multiplication syntax. Hex float literals are a different story. It's an understatement to say they are VERY rarely used, and that most progr

Re: [julia-users] Re: Why does the following give an error: p = 1; 2p+1 ??

2015-01-05 Thread Viral Shah
There is also an issue filed: https://github.com/JuliaLang/julia/issues/9617 -viral On Tuesday, January 6, 2015 12:29:33 AM UTC+5:30, Peter Mancini wrote: > > No. I'm tongue in cheek pointing out the absurdity of the situation. > > On Monday, January 5, 2015 12:57:45 PM UTC-6, Hans W Borchers wr

Re: [julia-users] Re: Why does the following give an error: p = 1; 2p+1 ??

2015-01-05 Thread Peter Mancini
No. I'm tongue in cheek pointing out the absurdity of the situation. On Monday, January 5, 2015 12:57:45 PM UTC-6, Hans W Borchers wrote: > > Does this mean you suggest to disallow variables names 'e', 'f', 'p' (and > possibly > others) in a programming environment for scientific computing? Hard

Re: [julia-users] Re: Why does the following give an error: p = 1; 2p+1 ??

2015-01-05 Thread Hans W Borchers
Does this mean you suggest to disallow variables names 'e', 'f', 'p' (and possibly others) in a programming environment for scientific computing? Hard to believe. On Monday, January 5, 2015 7:41:49 PM UTC+1, Peter Mancini wrote: > > That is a case of e being overloaded. It helps with the OP's

Re: [julia-users] Re: Why does the following give an error: p = 1; 2p+1 ??

2015-01-05 Thread Stefan Karpinski
To eliminate the ambiguity, one would have to disallow all variable names that start with the letter "e". At which point, one might as well go all the way and just disallow using "e" altogether and rename the language to Gadsby. On Mon, Jan 5, 2015 at 1:41 PM, Peter Mancini wrote: > That is a ca

Re: [julia-users] Re: Why does the following give an error: p = 1; 2p+1 ??

2015-01-05 Thread Peter Mancini
That is a case of e being overloaded. It helps with the OP's issue though. For the scientific notation issue I would suggest choosing which is more useful, natural e or using e for a base ten exponent. On Monday, January 5, 2015 12:22:11 PM UTC-6, Stefan Karpinski wrote: > > On Mon, Jan 5, 2015

Re: [julia-users] Re: Why does the following give an error: p = 1; 2p+1 ??

2015-01-05 Thread Stefan Karpinski
On Mon, Jan 5, 2015 at 12:55 PM, Peter Mancini wrote: > Usually a language handles this problem by making the constants such as p > and e as reserved. Thus you can't create a new variable with those names > and since they are constant you can't assign to them without raising an > error. > That d

[julia-users] Re: Why does the following give an error: p = 1; 2p+1 ??

2015-01-05 Thread Peter Mancini
Usually a language handles this problem by making the constants such as p and e as reserved. Thus you can't create a new variable with those names and since they are constant you can't assign to them without raising an error. --Pete

[julia-users] Re: Why does the following give an error: p = 1; 2p+1 ??

2015-01-05 Thread Hans W Borchers
It's the same with 'f', i.e. 1f+1 gives 10 and 1f + 1 an error (if f is not defined, else a different result again). And if someone introduces 'g' for "engineering notation", there will be an exception for this letter, too. By the way, has the bug x = 10; x.1 returning 1.0 been handled in 0.4? I

Re: [julia-users] Re: Why does the following give an error: p = 1; 2p+1 ??

2015-01-05 Thread Christoph Ortner
just noticed that Tamas already recommended that above. Just to reiterate I think this is the better way to resolve this particular issue. Christoph On Monday, 5 January 2015 15:04:27 UTC, Eric Forgy wrote: > > Maybe its not so bad if you just always include * where it should be, i.e. > p = 1

Re: [julia-users] Re: Why does the following give an error: p = 1; 2p+1 ??

2015-01-05 Thread Eric Forgy
Maybe its not so bad if you just always include * where it should be, i.e. p = 1; 2*p+1 works fine. On Mon, Jan 5, 2015 at 10:55 PM, Christoph Ortner < christophortn...@gmail.com> wrote: > For what it's worth, it always struck me is as odd that dropping the * for > multiplication is allowed. Is i

Re: [julia-users] Re: Why does the following give an error: p = 1; 2p+1 ??

2015-01-05 Thread Christoph Ortner
For what it's worth, it always struck me is as odd that dropping the * for multiplication is allowed. Is it worth dropping this instead of the p, e notation? Christoph

Re: [julia-users] Re: Why does the following give an error: p = 1; 2p+1 ??

2015-01-05 Thread Eric Forgy
Oh man. I hope this gets sorted out. I don't think this is a very pretty situation. p = 1; 2p+1 should do what you expect it to do.

Re: [julia-users] Re: Why does the following give an error: p = 1; 2p+1 ??

2015-01-05 Thread Simon Byrne
On Monday, 5 January 2015 13:48:31 UTC, Tamas Papp wrote: > > I think that using Unicode (outside ASCII) for numeric literals would be > more trouble than it is worth (typing, visually distinguishing them from > other similar-looking characters, etc). I feel that even if a language > supports Un

[julia-users] Re: Why does the following give an error: p = 1; 2p+1 ??

2015-01-05 Thread Jeff Waller
> Perhaps this is a good reason to change behaviour such that e is no longer > a constant: it has always seemed bit odd to use a valuable latin singleton > in this way. We could use a unicode script e (U+212F) instead, as suggested > by wikipedia: > > http://en.wikipedia.org/wiki/Numerals_in_U

Re: [julia-users] Re: Why does the following give an error: p = 1; 2p+1 ??

2015-01-05 Thread Tamas Papp
On Mon, Jan 05 2015, Simon Byrne wrote: >> >> * julia> 3e+1* >> * 30.0* >> >> *julia> 3e + 1* >> >> * 9.154845485377136* >> > > Perhaps this is a good reason to change behaviour such that e is no longer > a constant: it has always seemed bit odd to use a valuable latin singl

[julia-users] Re: Why does the following give an error: p = 1; 2p+1 ??

2015-01-05 Thread Simon Byrne
> > * julia> 3e+1* > * 30.0* > > *julia> 3e + 1* > > * 9.154845485377136* > Perhaps this is a good reason to change behaviour such that e is no longer a constant: it has always seemed bit odd to use a valuable latin singleton in this way. We could use a unicode script e (U+

[julia-users] Re: Why does the following give an error: p = 1; 2p+1 ??

2015-01-05 Thread elextr
On Monday, January 5, 2015 7:03:21 PM UTC+10, Arch Call wrote: > > On Julia version 3.4, the variable "P" also yields the same kind of error. > Yes Hex float accepts upper or lower case P its the same issue. Cheers Lex > > On Monday, January 5, 2015 2:44:38 AM UTC-5, Ronald L. Rivest wrote:

Re: [julia-users] Re: Why does the following give an error: p = 1; 2p+1 ??

2015-01-05 Thread Stefan Karpinski
On Mon, Jan 5, 2015 at 3:41 AM, Ronald L. Rivest wrote: > I fear that "numeric literal coefficients" may introduce more hazards than > its economy of notation justifies... ?? I'm somewhat inclined to agree. It's a really nice syntax, but there are so many exceptions now that it's pretty hard to

[julia-users] Re: Why does the following give an error: p = 1; 2p+1 ??

2015-01-05 Thread Arch Call
On Julia version 3.4, the variable "P" also yields the same kind of error. On Monday, January 5, 2015 2:44:38 AM UTC-5, Ronald L. Rivest wrote: > > I'm using Julia 0.3.4 command line. > Entering > p = 1; 2p+1 > gives an error: > > *julia> p = 1; 2p+1* > > *ERROR: syntax: malformed exp

[julia-users] Re: Why does the following give an error: p = 1; 2p+1 ??

2015-01-05 Thread Ronald L. Rivest
I now see the description of hex float notation in section 4.2 (Floating Point Numbers) of the manual (0.4.0-dev), which includes using "p" as binary exponent notation. I think that the error message could be improved, at a minimum. But there are problems with the current syntax that will cause

[julia-users] Re: Why does the following give an error: p = 1; 2p+1 ??

2015-01-05 Thread elextr
Raised https://github.com/JuliaLang/julia/issues/9617 Cheers Lex On Monday, January 5, 2015 6:00:46 PM UTC+10, ele...@gmail.com wrote: > > Think its taking 2p+1 as a malformed hex float literal > > Cheers > Lex > > On Monday, January 5, 2015 5:44:38 PM UTC+10, Ronald L. Rivest wrote: >> >> I'm us

[julia-users] Re: Why does the following give an error: p = 1; 2p+1 ??

2015-01-05 Thread elextr
Think its taking 2p+1 as a malformed hex float literal Cheers Lex On Monday, January 5, 2015 5:44:38 PM UTC+10, Ronald L. Rivest wrote: > > I'm using Julia 0.3.4 command line. > Entering > p = 1; 2p+1 > gives an error: > > *julia> p = 1; 2p+1* > > *ERROR: syntax: malformed expression

[julia-users] Re: Why does the following give an error: p = 1; 2p+1 ??

2015-01-04 Thread Jeff Waller
Also in 0.4.x this *julia> * *2p+* *(type-error double number #f)* *unexpected error: #0 (read-number # #f #f)**ERROR: syntax: malformed expression*