|
[Date Index]
[Thread Index]
[Author Index]
Re: Re: Unacceptable bug in Mathematica
But it does give a "valid expression".
v = ToExpression["Exp[]"]
Exp called with 0 arguments; 1 argument is expected.
Exp[]
True, you get a warning message, but after evaluation you have a valid
expression v, and you can use it to build further valid expressions:
In[4]:= f = Head[v]
Out[4]= Exp
In[5]:= f[1]
Out[5]= E
It's all perfectly valid.
Andrzej Kozlowski
On 14 Nov 2008, at 11:05, Savas Nesseris wrote:
> Dear Daniel,
> you say that:
> "Maybe you have in mind that Exp, being a built in "function" (that
> is, a
> symbol with DownValues attached to it), should require an
> "argument". Well
> and good, but that's progamming language semantics, not syntax."
>
> OK I accept this, however then you (Wolfram Research) should remove
> the
> following comment from the documentation of SyntaxQ, as it is
> misleading:
> "When SyntaxQ gives True, the string can be converted to an
> expression:"
>
> And definately,
>
> "Exp[]" // ToExpression
>
> does not give *a valid expression*...
>
> Cheers
>
> PS Thanks for clarifying this point with SyntaxQ
>
> 2008/11/13 Daniel Lichtblau <danl at wolfram.com>
>
>> psycho_dad wrote:
>>
>>> The other day, a friend discovered something that may qualify as a
>>> major bug in Mathematica (tested in 6.0.3):
>>>
>>> SyntaxQ["Exp[]"]
>>>
>>> (notice that Exp has no argument) returns
>>>
>>> True !!!!
>>>
>>> According to the documentation:
>>>
>>> SyntaxQ["string"] returns True if the string corresponds to
>>> syntactically correct input for a single Mathematica expression, and
>>> returns False otherwise.
>>>
>>> At least for me Exp[] is not syntactically correct. I expected more
>>> from Mathematica...
>>>
>>> Cheers
>>>
>>
>> There is no room for ambiguity in this sort of thing. Either it is
>> syntactically well formed, or it is not. This one is, in the sense of
>> Mathematica syntax. Just like the variant below.
>>
>> In[1]:= SyntaxQ["exp[]"]
>> Out[1]= True
>>
>> Maybe you have in mind that Exp, being a built in "function" (that
>> is, a
>> symbol with DownValues attached to it), should require an
>> "argument". Well
>> and good, but that's progamming language semantics, not syntax.
>>
>> On a side note, related to another recent post...if you type Exp[]
>> in a
>> version 6 front end, you will see a red arrow between the brackets,
>> indicating that there seems to be something "missing". So what we
>> refer to
>> as "syntax highlighting" really knows a bit of the language
>> semantics (and
>> goes well beyond just lexical analysis).
>>
>> Daniel Lichtblau
>> Wolfram Research
>>
>
>
Prev by Date:
Re: Re: How do little quickest
Next by Date:
Re: Stacked Definitions
Previous by thread:
Re: Unacceptable bug in Mathematica
Next by thread:
Re: Unacceptable bug in Mathematica
|