FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » error message I don understand
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
error message I don understand [message #174879] Fri, 15 July 2011 14:38 Go to next message
liebling.kreuzberg@gm is currently offline  liebling.kreuzberg@gm
Messages: 10
Registered: July 2011
Karma: 0
Junior Member
Hello group,

I'm doing some php programming on my own webserver.

I get the error message: PHP Fatal error: Can't use function return
value in write context in line 69

This is line 69: if (mysqli_num_rows($sDBResultaat) = 1 )

Either I don see what I'm doing wrong or I interpret the message wrong.
Either way I don't understand, can somebody point me the right way?

Thanks in advance, schimanski.
Re: error message I don understand [message #174880 is a reply to message #174879] Fri, 15 July 2011 14:44 Go to previous messageGo to next message
Billy Mays is currently offline  Billy Mays
Messages: 4
Registered: July 2011
Karma: 0
Junior Member
On 07/15/2011 10:38 AM, liebling(dot)kreuzberg(at)gmail(dot)com wrote:
> This is line 69: if (mysqli_num_rows($sDBResultaat) = 1 )

You need to use the comparison operator (==) rather than the assignment
operator (=).

--
Bill
Re: error message I don understand [message #174881 is a reply to message #174879] Fri, 15 July 2011 16:49 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
liebling(dot)kreuzberg(at)gmail(dot)com wrote:
> Hello group,
>
> I'm doing some php programming on my own webserver.
>
> I get the error message: PHP Fatal error: Can't use function return
> value in write context in line 69
>
> This is line 69: if (mysqli_num_rows($sDBResultaat) = 1 )
>
> Either I don see what I'm doing wrong or I interpret the message wrong.
> Either way I don't understand, can somebody point me the right way?
>
> Thanks in advance, schimanski.

That's a nice way of saying that you are a complete numpty and haven't
yet learnt to distinguish between assignment:-)

SET a=b

and comparison:

IF a==b

You can thank your lucky stars that your interpreter is merely obscure
in its error messages - heck if you had posted this to comp.lang.php or
something, you would have got an impenetrable answer from Stuckle AND
abuse, too;-)

However, I am pretty sure that I did this a couple of times when I
started programming, so I am only going to have a chuckle at your
glorious innocence, that reminds me of long long ago when programming a
computer was a new and very strange thing.
Re: error message I don understand [message #174882 is a reply to message #174881] Fri, 15 July 2011 17:25 Go to previous messageGo to next message
liebling.kreuzberg@gm is currently offline  liebling.kreuzberg@gm
Messages: 10
Registered: July 2011
Karma: 0
Junior Member
The Natural Philosopher wrote:

> liebling(dot)kreuzberg(at)gmail(dot)com wrote:
>> Hello group,
>>
>> I'm doing some php programming on my own webserver.
>>
>> I get the error message: PHP Fatal error: Can't use function return
>> value in write context in line 69
>>
>> This is line 69: if (mysqli_num_rows($sDBResultaat) = 1 )
>>
>> Either I don see what I'm doing wrong or I interpret the message wrong.
>> Either way I don't understand, can somebody point me the right way?
>>
>> Thanks in advance, schimanski.
>
> That's a nice way of saying that you are a complete numpty and haven't
> yet learnt to distinguish between assignment:-)
>
> SET a=b
>
> and comparison:
>
> IF a==b
>
> You can thank your lucky stars that your interpreter is merely obscure
> in its error messages - heck if you had posted this to comp.lang.php or
> something, you would have got an impenetrable answer from Stuckle AND
> abuse, too;-)
>
> However, I am pretty sure that I did this a couple of times when I
> started programming, so I am only going to have a chuckle at your
> glorious innocence, that reminds me of long long ago when programming a
> computer was a new and very strange thing.

Since I learned to program in a fair amount of computer languages, the
difference between = and == doesn't get the attention it needed to have.

Nevertheless I am delighted with your typecasting of me as someone
who is just asking. I hope you, as The Natural Philosopher are that much
enlighted that you will forgive me my typo......

Next time when I'm busy to ask something in your language, try to answer
it in mine. That makes you a philosopher.

Thanks, Schimanski.
Re: error message I don understand [message #174883 is a reply to message #174880] Fri, 15 July 2011 17:26 Go to previous messageGo to next message
liebling.kreuzberg@gm is currently offline  liebling.kreuzberg@gm
Messages: 10
Registered: July 2011
Karma: 0
Junior Member
Billy Mays wrote:

> On 07/15/2011 10:38 AM, liebling(dot)kreuzberg(at)gmail(dot)com wrote:
>> This is line 69: if (mysqli_num_rows($sDBResultaat) = 1 )
>
> You need to use the comparison operator (==) rather than the assignment
> operator (=).
>
Thanks for the polite answer. I did miss that.

Best regards, Schimanski.
Re: error message I don understand [message #174884 is a reply to message #174883] Fri, 15 July 2011 17:45 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
liebling(dot)kreuzberg(at)gmail(dot)com wrote:
> Billy Mays wrote:
>
>> On 07/15/2011 10:38 AM, liebling(dot)kreuzberg(at)gmail(dot)com wrote:
>>> This is line 69: if (mysqli_num_rows($sDBResultaat) = 1 )
>> You need to use the comparison operator (==) rather than the assignment
>> operator (=).
>>
> Thanks for the polite answer. I did miss that.
>
> Best regards, Schimanski.

Odd, since I said exactly the same thing, with added humour.
Re: error message I don understand [message #174885 is a reply to message #174884] Fri, 15 July 2011 18:36 Go to previous messageGo to next message
liebling.kreuzberg@gm is currently offline  liebling.kreuzberg@gm
Messages: 10
Registered: July 2011
Karma: 0
Junior Member
The Natural Philosopher wrote:

> liebling(dot)kreuzberg(at)gmail(dot)com wrote:
>> Billy Mays wrote:
>>
>>> On 07/15/2011 10:38 AM, liebling(dot)kreuzberg(at)gmail(dot)com wrote:
>>>> This is line 69: if (mysqli_num_rows($sDBResultaat) = 1 )
>>> You need to use the comparison operator (==) rather than the assignment
>>> operator (=).
>>>
>> Thanks for the polite answer. I did miss that.
>>
>> Best regards, Schimanski.
>
> Odd, since I said exactly the same thing, with added humour.

Hmmm, strange form of humour. Not my cup of ........
Maybe due to the fact that Englis (nor American) is not my mothertongue.

BR, Schimanski
Re: error message I don understand [message #174886 is a reply to message #174885] Fri, 15 July 2011 19:25 Go to previous messageGo to next message
VanguardLH is currently offline  VanguardLH
Messages: 5
Registered: April 2011
Karma: 0
Junior Member
liebling.kreuzberg wrote:

> Natural Philosopher wrote:
>
>> Odd, since I said exactly the same thing, with added humour.
>
> Hmmm, strange form of humour. Not my cup of ........
> Maybe due to the fact that Englis (nor American) is not my mothertongue.

Natural posted 2 hours *after* Billy and, of course, we're supposed to
assume that he didn't see Billy's reply to spur him onto the same
solution but differently composed.

In some programming languages, the "=" is not an assignment operator
when its context is within the conditional clause. In others, it is an
assignment operator (followed by a Boolean test for true or false) and
is sometimes used as a cheat but usually for the right-side operand. If
you had reversed the left- and right-side operands you wouldn't get an
error in all languages and instead might get an assignment that you
didn't expect along with an action by the 'if' that was unplanned.

Sometimes another pair of eyes will see your mistake. Too often your
eyes see what your mind expects to see. Bouncing between multiple
programming languages doesn't help, either. Don't let Natural fool you:
this is a mistake common to ALL programmers and shows up often enough
that all of them recognize the mistake because it wasn't so long ago
since they made that same mistake.
Re: error message I don understand [message #174887 is a reply to message #174885] Fri, 15 July 2011 20:35 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
liebling(dot)kreuzberg(at)gmail(dot)com wrote:
> The Natural Philosopher wrote:
>
>> liebling(dot)kreuzberg(at)gmail(dot)com wrote:
>>> Billy Mays wrote:
>>>
>>>> On 07/15/2011 10:38 AM, liebling(dot)kreuzberg(at)gmail(dot)com wrote:
>>>> > This is line 69: if (mysqli_num_rows($sDBResultaat) = 1 )
>>>> You need to use the comparison operator (==) rather than the assignment
>>>> operator (=).
>>>>
>>> Thanks for the polite answer. I did miss that.
>>>
>>> Best regards, Schimanski.
>> Odd, since I said exactly the same thing, with added humour.
>
> Hmmm, strange form of humour. Not my cup of ........
> Maybe due to the fact that Englis (nor American) is not my mothertongue.
>

That OK, the main thing is to learn PHP...


> BR, Schimanski
Re: error message I don understand [message #174888 is a reply to message #174886] Fri, 15 July 2011 20:36 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
VanguardLH wrote:
> liebling.kreuzberg wrote:
>
>> Natural Philosopher wrote:
>>
>>> Odd, since I said exactly the same thing, with added humour.
>> Hmmm, strange form of humour. Not my cup of ........
>> Maybe due to the fact that Englis (nor American) is not my mothertongue.
>
> Natural posted 2 hours *after* Billy and, of course, we're supposed to
> assume that he didn't see Billy's reply to spur him onto the same
> solution but differently composed.
>
> In some programming languages, the "=" is not an assignment operator
> when its context is within the conditional clause. In others, it is an
> assignment operator (followed by a Boolean test for true or false) and
> is sometimes used as a cheat but usually for the right-side operand. If
> you had reversed the left- and right-side operands you wouldn't get an
> error in all languages and instead might get an assignment that you
> didn't expect along with an action by the 'if' that was unplanned.
>
> Sometimes another pair of eyes will see your mistake. Too often your
> eyes see what your mind expects to see. Bouncing between multiple
> programming languages doesn't help, either. Don't let Natural fool you:
> this is a mistake common to ALL programmers and shows up often enough
> that all of them recognize the mistake because it wasn't so long ago
> since they made that same mistake.

Ah but when I first made it it was because I didn't know better

Today its just a typo.;-)
Re: error message I don understand [message #174889 is a reply to message #174888] Sat, 16 July 2011 09:17 Go to previous messageGo to next message
liebling.kreuzberg@gm is currently offline  liebling.kreuzberg@gm
Messages: 10
Registered: July 2011
Karma: 0
Junior Member
The Natural Philosopher wrote:

> VanguardLH wrote:
>> liebling.kreuzberg wrote:
>>
>>> Natural Philosopher wrote:
>>>
>>>> Odd, since I said exactly the same thing, with added humour.
>>> Hmmm, strange form of humour. Not my cup of ........
>>> Maybe due to the fact that Englis (nor American) is not my mothertongue.
>>
>> Natural posted 2 hours *after* Billy and, of course, we're supposed to
>> assume that he didn't see Billy's reply to spur him onto the same
>> solution but differently composed.
>>
>> In some programming languages, the "=" is not an assignment operator
>> when its context is within the conditional clause. In others, it is an
>> assignment operator (followed by a Boolean test for true or false) and
>> is sometimes used as a cheat but usually for the right-side operand. If
>> you had reversed the left- and right-side operands you wouldn't get an
>> error in all languages and instead might get an assignment that you
>> didn't expect along with an action by the 'if' that was unplanned.
>>
>> Sometimes another pair of eyes will see your mistake. Too often your
>> eyes see what your mind expects to see. Bouncing between multiple
>> programming languages doesn't help, either. Don't let Natural fool you:
>> this is a mistake common to ALL programmers and shows up often enough
>> that all of them recognize the mistake because it wasn't so long ago
>> since they made that same mistake.
>
> Ah but when I first made it it was because I didn't know better
>
> Today its just a typo.;-)

Never mind, I learned something I didn't know and that is a win.

BR, Schimanski
Re: error message I don understand [message #174890 is a reply to message #174889] Sat, 16 July 2011 12:52 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
liebling(dot)kreuzberg(at)gmail(dot)com wrote:
> The Natural Philosopher wrote:
>
>> VanguardLH wrote:
>>> liebling.kreuzberg wrote:
>>>
>>>> Natural Philosopher wrote:
>>>>
>>>> > Odd, since I said exactly the same thing, with added humour.
>>>> Hmmm, strange form of humour. Not my cup of ........
>>>> Maybe due to the fact that Englis (nor American) is not my mothertongue.
>>> Natural posted 2 hours *after* Billy and, of course, we're supposed to
>>> assume that he didn't see Billy's reply to spur him onto the same
>>> solution but differently composed.
>>>
>>> In some programming languages, the "=" is not an assignment operator
>>> when its context is within the conditional clause. In others, it is an
>>> assignment operator (followed by a Boolean test for true or false) and
>>> is sometimes used as a cheat but usually for the right-side operand. If
>>> you had reversed the left- and right-side operands you wouldn't get an
>>> error in all languages and instead might get an assignment that you
>>> didn't expect along with an action by the 'if' that was unplanned.
>>>
>>> Sometimes another pair of eyes will see your mistake. Too often your
>>> eyes see what your mind expects to see. Bouncing between multiple
>>> programming languages doesn't help, either. Don't let Natural fool you:
>>> this is a mistake common to ALL programmers and shows up often enough
>>> that all of them recognize the mistake because it wasn't so long ago
>>> since they made that same mistake.
>> Ah but when I first made it it was because I didn't know better
>>
>> Today its just a typo.;-)
>
> Never mind, I learned something I didn't know and that is a win.
>
> BR, Schimanski
>


Well you got your answer, I had some fun, reminiscing about the first
uncertain steps we all take in programming, and no harm was done, so a
win win hopefully.

I remember many years ago I went back to sort out some issues in some C
code..someone else had taken ober

" I see you don't like using the 'switch..case' statement, its all
nested 'if then else' here'

"No, I like it. Then I wasn't sure of the syntax, and I was under heavy
pressure to get this working, so I used what I was familiar with".

(I didn't want to tell her it was in fact the first commercial C code I
had ever written).
Re: error message I don understand [message #174891 is a reply to message #174885] Sat, 16 July 2011 13:30 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 7/15/2011 2:36 PM, liebling(dot)kreuzberg(at)gmail(dot)com wrote:
> The Natural Philosopher wrote:
>
>> liebling(dot)kreuzberg(at)gmail(dot)com wrote:
>>> Billy Mays wrote:
>>>
>>>> On 07/15/2011 10:38 AM, liebling(dot)kreuzberg(at)gmail(dot)com wrote:
>>>> > This is line 69: if (mysqli_num_rows($sDBResultaat) = 1 )
>>>> You need to use the comparison operator (==) rather than the assignment
>>>> operator (=).
>>>>
>>> Thanks for the polite answer. I did miss that.
>>>
>>> Best regards, Schimanski.
>>
>> Odd, since I said exactly the same thing, with added humour.
>
> Hmmm, strange form of humour. Not my cup of ........
> Maybe due to the fact that Englis (nor American) is not my mothertongue.
>
> BR, Schimanski

You have to understand TNP. He's not a programmer (nor even the
engineer he portends to be). He really doesn't understand a lot.

What he does is wait for someone else to answer, reword it into an
insult (if he even understands the original response) then, when called
on it, claim it's "humor".

It's unfortunate that we have to put up with his trolling. But then he
wouldn't want people to find out who he really is - which is why he
tries to hide behind a 'nym.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: error message I don understand [message #174893 is a reply to message #174891] Sat, 16 July 2011 19:14 Go to previous messageGo to next message
liebling.kreuzberg@gm is currently offline  liebling.kreuzberg@gm
Messages: 10
Registered: July 2011
Karma: 0
Junior Member
Jerry Stuckle wrote:

> On 7/15/2011 2:36 PM, liebling(dot)kreuzberg(at)gmail(dot)com wrote:
>> The Natural Philosopher wrote:
>>
>>> liebling(dot)kreuzberg(at)gmail(dot)com wrote:
>>>> Billy Mays wrote:
>>>>
>>>> > On 07/15/2011 10:38 AM, liebling(dot)kreuzberg(at)gmail(dot)com wrote:
>>>> >> This is line 69: if (mysqli_num_rows($sDBResultaat) = 1 )
>>>> > You need to use the comparison operator (==) rather than the assignment
>>>> > operator (=).
>>>> >
>>>> Thanks for the polite answer. I did miss that.
>>>>
>>>> Best regards, Schimanski.
>>>
>>> Odd, since I said exactly the same thing, with added humour.
>>
>> Hmmm, strange form of humour. Not my cup of ........
>> Maybe due to the fact that Englis (nor American) is not my mothertongue.
>>
>> BR, Schimanski
>
> You have to understand TNP. He's not a programmer (nor even the
> engineer he portends to be). He really doesn't understand a lot.
>
> What he does is wait for someone else to answer, reword it into an
> insult (if he even understands the original response) then, when called
> on it, claim it's "humor".
>
> It's unfortunate that we have to put up with his trolling. But then he
> wouldn't want people to find out who he really is - which is why he
> tries to hide behind a 'nym.
>
Thanks for explaining. I'm relatively new to this newsgroup, so I have
to learn who is a troll and who is really doing a good job in helping.

Over time I'll learn to distinguish trolls from helpers.....

BR, Schimanski.
Re: error message I don understand [message #174894 is a reply to message #174879] Sat, 16 July 2011 19:28 Go to previous messageGo to next message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
Senior Member
On Fri, 15 Jul 2011 14:38:28 +0000, liebling(dot)kreuzberg(at)gmail(dot)com wrote:


> I'm doing some php programming on my own webserver.
>
> I get the error message: PHP Fatal error: Can't use function return
> value in write context in line 69
>
> This is line 69: if (mysqli_num_rows($sDBResultaat) = 1 )
>
> Either I don see what I'm doing wrong or I interpret the message wrong.
> Either way I don't understand, can somebody point me the right way?

Consider:

<?php

function x()
{
return 5;
}

x() = 1;

?>

although x() gives the value 5, it is not a variable that can be set, and
so you can not assign (or write) a value (such as 1) to it.

The php error message is saying that you can't assign (or write) a value
to a function call, or in other words, the return value of a function
call is read_only data.

Rgds

Denis McMahon
Re: error message I don understand [message #174895 is a reply to message #174893] Sat, 16 July 2011 21:18 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
liebling(dot)kreuzberg(at)gmail(dot)com wrote:
> Jerry Stuckle wrote:
>
>> On 7/15/2011 2:36 PM, liebling(dot)kreuzberg(at)gmail(dot)com wrote:
>>> The Natural Philosopher wrote:
>>>
>>>> liebling(dot)kreuzberg(at)gmail(dot)com wrote:
>>>> > Billy Mays wrote:
>>>> >
>>>> >> On 07/15/2011 10:38 AM, liebling(dot)kreuzberg(at)gmail(dot)com wrote:
>>>> >>> This is line 69: if (mysqli_num_rows($sDBResultaat) = 1 )
>>>> >> You need to use the comparison operator (==) rather than the assignment
>>>> >> operator (=).
>>>> >>
>>>> > Thanks for the polite answer. I did miss that.
>>>> >
>>>> > Best regards, Schimanski.
>>>> Odd, since I said exactly the same thing, with added humour.
>>> Hmmm, strange form of humour. Not my cup of ........
>>> Maybe due to the fact that Englis (nor American) is not my mothertongue.
>>>
>>> BR, Schimanski
>> You have to understand TNP. He's not a programmer (nor even the
>> engineer he portends to be). He really doesn't understand a lot.
>>
>> What he does is wait for someone else to answer, reword it into an
>> insult (if he even understands the original response) then, when called
>> on it, claim it's "humor".
>>
>> It's unfortunate that we have to put up with his trolling. But then he
>> wouldn't want people to find out who he really is - which is why he
>> tries to hide behind a 'nym.
>>
> Thanks for explaining. I'm relatively new to this newsgroup, so I have
> to learn who is a troll and who is really doing a good job in helping.
>
> Over time I'll learn to distinguish trolls from helpers.....
>

well you just met ine there. Trolls

> BR, Schimanski.
Re: error message I don understand [message #174896 is a reply to message #174894] Sun, 17 July 2011 08:21 Go to previous messageGo to next message
liebling.kreuzberg@gm is currently offline  liebling.kreuzberg@gm
Messages: 10
Registered: July 2011
Karma: 0
Junior Member
Denis McMahon wrote:

> On Fri, 15 Jul 2011 14:38:28 +0000, liebling(dot)kreuzberg(at)gmail(dot)com wrote:
>
>
>> I'm doing some php programming on my own webserver.
>>
>> I get the error message: PHP Fatal error: Can't use function return
>> value in write context in line 69
>>
>> This is line 69: if (mysqli_num_rows($sDBResultaat) = 1 )
>>
>> Either I don see what I'm doing wrong or I interpret the message wrong.
>> Either way I don't understand, can somebody point me the right way?
>
> Consider:
>
> <?php
>
> function x()
> {
> return 5;
> }
>
> x() = 1;
>
> ?>
>
> although x() gives the value 5, it is not a variable that can be set, and
> so you can not assign (or write) a value (such as 1) to it.
>
> The php error message is saying that you can't assign (or write) a value
> to a function call, or in other words, the return value of a function
> call is read_only data.
>
> Rgds
>
> Denis McMahon

Thanks Dennis.

Good addition to the explanation of Billy.

BR, Schimanski
Re: error message I don understand [message #174897 is a reply to message #174896] Sun, 17 July 2011 09:10 Go to previous messageGo to next message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
liebling(dot)kreuzberg(at)gmail(dot)com wrote:

> Denis McMahon wrote:
>> Consider:
>>
>> <?php
>>
>> function x()
>> {
>> return 5;
>> }
>>
>> x() = 1;
>>
>> ?>
>>
>> although x() gives the value 5, it is not a variable that can be set, and
>> so you can not assign (or write) a value (such as 1) to it.
>>
>> The php error message is saying that you can't assign (or write) a value
>> to a function call, or in other words, the return value of a function
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> call is read_only data.
^^^^^^^^^^^^^^^^^^^^^^^
> Thanks Dennis.
>
> Good addition to the explanation of Billy.

In the end an oversimplified, wrong explanation. It is a syntactical
requirement, not a functional one:

function x()
{
return array(23);
}

$a = x();

$a[0] = 42;

/*
* Array
* (
* [0] => 42
* )
*/
print_r($a);

You would be well-advised to post under your real name, as it is customary
in Usenet.


PointedEars
--
Danny Goodman's books are out of date and teach practices that are
positively harmful for cross-browser scripting.
-- Richard Cornford, cljs, <cife6q$253$1$8300dec7(at)news(dot)demon(dot)co(dot)uk> (2004)
Re: error message I don understand [message #174898 is a reply to message #174897] Sun, 17 July 2011 09:20 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
Thomas 'PointedEars' Lahn wrote:
> liebling(dot)kreuzberg(at)gmail(dot)com wrote:
>
>> Denis McMahon wrote:
>>> Consider:
>>>
>>> <?php
>>>
>>> function x()
>>> {
>>> return 5;
>>> }
>>>
>>> x() = 1;
>>>
>>> ?>
>>>
>>> although x() gives the value 5, it is not a variable that can be set, and
>>> so you can not assign (or write) a value (such as 1) to it.
>>>
>>> The php error message is saying that you can't assign (or write) a value
>>> to a function call, or in other words, the return value of a function
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>> call is read_only data.
> ^^^^^^^^^^^^^^^^^^^^^^^
>> Thanks Dennis.
>>
>> Good addition to the explanation of Billy.
>
> In the end an oversimplified, wrong explanation. It is a syntactical
> requirement, not a functional one:
>
> function x()
> {
> return array(23);
> }
>
> $a = x();
>
> $a[0] = 42;
>
> /*
> * Array
> * (
> * [0] => 42
> * )
> */
> print_r($a);
>

fair point, if pedantic.


> You would be well-advised to post under your real name, as it is customary
> in Usenet.
>

And have the Stuckle stalk you in real life?

I think not.

>
> PointedEars
Re: error message I don understand [message #174899 is a reply to message #174879] Sun, 17 July 2011 12:55 Go to previous messageGo to next message
August Karlstrom is currently offline  August Karlstrom
Messages: 16
Registered: October 2010
Karma: 0
Junior Member
On 2011-07-15 16:38, liebling(dot)kreuzberg(at)gmail(dot)com wrote:
> Hello group,
>
> I'm doing some php programming on my own webserver.
>
> I get the error message: PHP Fatal error: Can't use function return
> value in write context in line 69
>
> This is line 69: if (mysqli_num_rows($sDBResultaat) = 1 )
>
> Either I don see what I'm doing wrong or I interpret the message wrong.
> Either way I don't understand, can somebody point me the right way?
>
> Thanks in advance, schimanski.

It is a very easy mistake to do if you are used to saner programming
languages in which `=' has the standard mathematical meaning (this
symbol has been used in mathematics to denote equality for some 500 years).

August

--
The competent programmer is fully aware of the limited size of his own
skull. He therefore approaches his task with full humility, and avoids
clever tricks like the plague. --Edsger Dijkstra
Re: error message I don understand [message #174900 is a reply to message #174897] Sun, 17 July 2011 13:00 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 7/17/2011 5:10 AM, Thomas 'PointedEars' Lahn wrote:
> liebling(dot)kreuzberg(at)gmail(dot)com wrote:
>
>> Denis McMahon wrote:
>>> Consider:
>>>
>>> <?php
>>>
>>> function x()
>>> {
>>> return 5;
>>> }
>>>
>>> x() = 1;
>>>
>>> ?>
>>>
>>> although x() gives the value 5, it is not a variable that can be set, and
>>> so you can not assign (or write) a value (such as 1) to it.
>>>
>>> The php error message is saying that you can't assign (or write) a value
>>> to a function call, or in other words, the return value of a function
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>> call is read_only data.
> ^^^^^^^^^^^^^^^^^^^^^^^
>> Thanks Dennis.
>>
>> Good addition to the explanation of Billy.
>
> In the end an oversimplified, wrong explanation. It is a syntactical
> requirement, not a functional one:
>
> function x()
> {
> return array(23);
> }
>
> $a = x();
>
> $a[0] = 42;
>
> /*
> * Array
> * (
> * [0] => 42
> * )
> */
> print_r($a);
>
> You would be well-advised to post under your real name, as it is customary
> in Usenet.
>
>
> PointedEars

Which has absolutely nothing to do with the problem the op had, or with
Dennis's explanation (which, btw, is one of the better ones I've seen
for this particular problem).

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: error message I don understand [message #174901 is a reply to message #174898] Sun, 17 July 2011 13:01 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 7/17/2011 5:20 AM, The Natural Philosopher wrote:
> Thomas 'PointedEars' Lahn wrote:
>> liebling(dot)kreuzberg(at)gmail(dot)com wrote:
>>
>>> Denis McMahon wrote:
>>>> Consider:
>>>>
>>>> <?php
>>>>
>>>> function x()
>>>> {
>>>> return 5;
>>>> }
>>>>
>>>> x() = 1;
>>>>
>>>> ?>
>>>>
>>>> although x() gives the value 5, it is not a variable that can be
>>>> set, and
>>>> so you can not assign (or write) a value (such as 1) to it.
>>>>
>>>> The php error message is saying that you can't assign (or write) a
>>>> value
>>>> to a function call, or in other words, the return value of a function
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>>> call is read_only data.
>> ^^^^^^^^^^^^^^^^^^^^^^^
>>> Thanks Dennis.
>>>
>>> Good addition to the explanation of Billy.
>>
>> In the end an oversimplified, wrong explanation. It is a syntactical
>> requirement, not a functional one:
>>
>> function x()
>> {
>> return array(23);
>> }
>>
>> $a = x();
>>
>> $a[0] = 42;
>>
>> /* * Array
>> * (
>> * [0] => 42 * )
>> */
>> print_r($a);
>>
>
> fair point, if pedantic.
>
>
>> You would be well-advised to post under your real name, as it is
>> customary in Usenet.
>>
>
> And have the Stuckle stalk you in real life?
>
> I think not.
>

LOL, are you hearing little voices in your head again?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: error message I don understand [message #174902 is a reply to message #174899] Sun, 17 July 2011 13:03 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 7/17/2011 8:55 AM, August Karlstrom wrote:
> On 2011-07-15 16:38, liebling(dot)kreuzberg(at)gmail(dot)com wrote:
>> Hello group,
>>
>> I'm doing some php programming on my own webserver.
>>
>> I get the error message: PHP Fatal error: Can't use function return
>> value in write context in line 69
>>
>> This is line 69: if (mysqli_num_rows($sDBResultaat) = 1 )
>>
>> Either I don see what I'm doing wrong or I interpret the message wrong.
>> Either way I don't understand, can somebody point me the right way?
>>
>> Thanks in advance, schimanski.
>
> It is a very easy mistake to do if you are used to saner programming
> languages in which `=' has the standard mathematical meaning (this
> symbol has been used in mathematics to denote equality for some 500 years).
>
> August
>

This isn't mathematics - it is programming, as people have told you
before. If you want mathematics, get a chalkboard.

Please tell me in mathematics what the '*' sign means. Or '^'? Maybe '||'?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: error message I don understand [message #174903 is a reply to message #174897] Sun, 17 July 2011 14:52 Go to previous messageGo to next message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
Senior Member
On Sun, 17 Jul 2011 11:10:30 +0200, Thomas 'PointedEars' Lahn wrote:

> In the end an oversimplified, wrong explanation. It is a syntactical
> requirement, not a functional one:

> $a = x();

Here you're assigning the return value of the function x() to the
variable $a.

> $a[0] = 42;

Here you're writing to the variable $a (or rather, in this case, to an
element of the array that is variable $a).

Neither of these is trying to assign (write) a value to the return value
of the function call. Whether you call the issue syntactical or not is
just irrelevant and messing about with semantics.

Rgds

Denis McMahon
Re: error message I don understand [message #174904 is a reply to message #174902] Sun, 17 July 2011 14:50 Go to previous messageGo to next message
August Karlstrom is currently offline  August Karlstrom
Messages: 16
Registered: October 2010
Karma: 0
Junior Member
On 2011-07-17 15:03, Jerry Stuckle wrote:
> On 7/17/2011 8:55 AM, August Karlstrom wrote:
>> It is a very easy mistake to do if you are used to saner programming
>> languages in which `=' has the standard mathematical meaning (this
>> symbol has been used in mathematics to denote equality for some 500
>> years).
>>
>> August
>>
>
> This isn't mathematics - it is programming, as people have told you
> before. If you want mathematics, get a chalkboard.

Don't be silly. There are several programming languages in which `='
denote (surprise) equality.

> Please tell me in mathematics what the '*' sign means. Or '^'? Maybe '||'?

You do not seem get my point. It is the practice of redefining the
meaning of a well known symbol (=) where the original concept (equality)
is still needed and therefor denoted by a different token (==) that I
find a really bad idea.

August

--
The competent programmer is fully aware of the limited size of his own
skull. He therefore approaches his task with full humility, and avoids
clever tricks like the plague. --Edsger Dijkstra
Re: error message I don understand [message #174905 is a reply to message #174900] Sun, 17 July 2011 14:53 Go to previous messageGo to next message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
Senior Member
On Sun, 17 Jul 2011 09:00:53 -0400, Jerry Stuckle wrote:

> Which has absolutely nothing to do with the problem the op had, or with
> Dennis's explanation (which, btw, is one of the better ones I've seen
> for this particular problem).

Yeah, well part of what I was doing was trying to explain to the OP why
PHP expresses the error in english the way it does, given that the OP
might not be a native english speaker.

It's very easy sometimes for us who are generally working with IT in our
native languages to remember that for a lot of people, when they get an
error message, their first problem with understanding the error is that
they have to translate the error message into their own language, and
things can get obscured by the translation.

I'm sure I'm not the only one who would love to see T'PE'L give an
explanation for the OPs original error message, but I've noticed that he
seems to prefer making disparaging comments about other people's
solutions and comments rather than making any contributions of his own,
and on the rare occasions he does contribute, mostly he posts links to
other people's work.

I did see his attempt to correct me, but what he demonstrates is not what
I said can't be done. Looks like he has comprehension as well as semantic
issues ...

Rgds

Denis McMahon
Re: error message I don understand [message #174906 is a reply to message #174904] Sun, 17 July 2011 16:26 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 7/17/2011 10:50 AM, August Karlstrom wrote:
> On 2011-07-17 15:03, Jerry Stuckle wrote:
>> On 7/17/2011 8:55 AM, August Karlstrom wrote:
>>> It is a very easy mistake to do if you are used to saner programming
>>> languages in which `=' has the standard mathematical meaning (this
>>> symbol has been used in mathematics to denote equality for some 500
>>> years).
>>>
>>> August
>>>
>>
>> This isn't mathematics - it is programming, as people have told you
>> before. If you want mathematics, get a chalkboard.
>
> Don't be silly. There are several programming languages in which `='
> denote (surprise) equality.
>
>> Please tell me in mathematics what the '*' sign means. Or '^'? Maybe
>> '||'?
>
> You do not seem get my point. It is the practice of redefining the
> meaning of a well known symbol (=) where the original concept (equality)
> is still needed and therefor denoted by a different token (==) that I
> find a really bad idea.
>
> August
>

Sure I get your point. And in many computer languages, '=' is an
assignment operator. I first learned this back in the 60's when I was
using FORTRAN. It has been that way for a long time, and many more
languages use '=' for assignment than not.

But you completely missed my point. This is not mathematics. This is
programming. You don't like the language syntax? You are free to
create your own language.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: error message I don understand [message #174907 is a reply to message #174905] Sun, 17 July 2011 16:26 Go to previous messageGo to next message
dougatmilmacdotcom is currently offline  dougatmilmacdotcom
Messages: 24
Registered: May 2011
Karma: 0
Junior Member
In article <4e22f778$0$19167$a8266bb1(at)newsreader(dot)readnews(dot)com>, Denis McMahon <denis(dot)m(dot)f(dot)mcmahon(at)gmail(dot)com> wrote:

> I'm sure I'm not the only one who would love to see T'PE'L give an
> explanation for the OPs original error message, but I've noticed that he
> seems to prefer making disparaging comments about other people's
> solutions and comments rather than making any contributions of his own,
> and on the rare occasions he does contribute, mostly he posts links to
> other people's work.
>
> I did see his attempt to correct me, but what he demonstrates is not what
> I said can't be done. Looks like he has comprehension as well as semantic
> issues ...

English is not PointedHead's first language. And, although he can write
it fairly well, he does not understand it as well as he thinks he does.
Re: error message I don understand [message #174908 is a reply to message #174904] Sun, 17 July 2011 16:31 Go to previous messageGo to next message
Peter H. Coffin is currently offline  Peter H. Coffin
Messages: 245
Registered: September 2010
Karma: 0
Senior Member
On Sun, 17 Jul 2011 16:50:28 +0200, August Karlstrom wrote:

> On 2011-07-17 15:03, Jerry Stuckle wrote:
>
>> This isn't mathematics - it is programming, as people have told you
>> before. If you want mathematics, get a chalkboard.
>
> Don't be silly. There are several programming languages in which `='
> denote (surprise) equality.

Very few that use it alone. They may set the context with a previous
"LET" or "test" or a grouping indicator, or, if they don't, they have
very rigorous typing such that assignments are statements alone and do
NOT return anything that could possibly be used in a logical/comparative
way, not even a success or failure.

--
43. I will maintain a healthy amount of skepticism when I capture the
beautiful rebel and she claims she is attracted to my power and
good looks and will gladly betray her companions if I just let her
in on my plans. --Peter Anspach's Evil Overlord list
Nasty language semantics (Was: error message I don understand) [message #174909 is a reply to message #174908] Sun, 17 July 2011 17:47 Go to previous messageGo to next message
August Karlstrom is currently offline  August Karlstrom
Messages: 16
Registered: October 2010
Karma: 0
Junior Member
On 2011-07-17 18:31, Peter H. Coffin wrote:
> On Sun, 17 Jul 2011 16:50:28 +0200, August Karlstrom wrote:
>
>> On 2011-07-17 15:03, Jerry Stuckle wrote:
>>
>>> This isn't mathematics - it is programming, as people have told you
>>> before. If you want mathematics, get a chalkboard.
>>
>> Don't be silly. There are several programming languages in which `='
>> denote (surprise) equality.
>
> Very few that use it alone.

Pascal, Modula-2, Eiffel and Ada all use `=' for equality and `:=' for
assignment.

> They may set the context with a previous
> "LET" or "test" or a grouping indicator, or, if they don't, they have
> very rigorous typing such that assignments are statements alone and do
> NOT return anything that could possibly be used in a logical/comparative
> way, not even a success or failure.

Yes, and for a good reason - the statement-expression separation (or
maybe we should say side-effect free expressions) is related to the
sound principle of command-query separation.

August

--
The competent programmer is fully aware of the limited size of his own
skull. He therefore approaches his task with full humility, and avoids
clever tricks like the plague. --Edsger Dijkstra
Re: Nasty language semantics (Was: error message I don understand) [message #174910 is a reply to message #174909] Sun, 17 July 2011 18:12 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 7/17/2011 1:47 PM, August Karlstrom wrote:
> On 2011-07-17 18:31, Peter H. Coffin wrote:
>> On Sun, 17 Jul 2011 16:50:28 +0200, August Karlstrom wrote:
>>
>>> On 2011-07-17 15:03, Jerry Stuckle wrote:
>>>
>>>> This isn't mathematics - it is programming, as people have told you
>>>> before. If you want mathematics, get a chalkboard.
>>>
>>> Don't be silly. There are several programming languages in which `='
>>> denote (surprise) equality.
>>
>> Very few that use it alone.
>
> Pascal, Modula-2, Eiffel and Ada all use `=' for equality and `:=' for
> assignment.
>

Yup, four little used languages use it. Versus dozens of heavily used
languages.

>> They may set the context with a previous
>> "LET" or "test" or a grouping indicator, or, if they don't, they have
>> very rigorous typing such that assignments are statements alone and do
>> NOT return anything that could possibly be used in a logical/comparative
>> way, not even a success or failure.
>
> Yes, and for a good reason - the statement-expression separation (or
> maybe we should say side-effect free expressions) is related to the
> sound principle of command-query separation.
>
> August
>

Yup, and you wonder why such languages are so seldom used - while others
such as C, C++, Java and PHP are used much more than any of the ones you
mentioned, at least in production?

As I said - you don't like the syntax, create your own language with
whatever syntax you want. No one is forcing you to use PHP or any other
language with syntax you don't like.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Nasty language semantics (Was: error message I don understand) [message #174911 is a reply to message #174909] Sun, 17 July 2011 18:26 Go to previous messageGo to next message
Robert Heller is currently offline  Robert Heller
Messages: 60
Registered: December 2010
Karma: 0
Member
At Sun, 17 Jul 2011 19:47:12 +0200 August Karlstrom <fusionfile(at)gmail(dot)com> wrote:

>
> On 2011-07-17 18:31, Peter H. Coffin wrote:
>> On Sun, 17 Jul 2011 16:50:28 +0200, August Karlstrom wrote:
>>
>>> On 2011-07-17 15:03, Jerry Stuckle wrote:
>>>
>>>> This isn't mathematics - it is programming, as people have told you
>>>> before. If you want mathematics, get a chalkboard.
>>>
>>> Don't be silly. There are several programming languages in which `='
>>> denote (surprise) equality.
>>
>> Very few that use it alone.
>
> Pascal, Modula-2, Eiffel and Ada all use `=' for equality and `:=' for
> assignment.

Also: don't forget Basic. Basic uses '=' for both equality
AND assignment, but you cannot perform an assignment someplace where a
logical (or any other) expression might occur, so there is no ambiguity.

>
>> They may set the context with a previous
>> "LET" or "test" or a grouping indicator, or, if they don't, they have
>> very rigorous typing such that assignments are statements alone and do
>> NOT return anything that could possibly be used in a logical/comparative
>> way, not even a success or failure.
>
> Yes, and for a good reason - the statement-expression separation (or
> maybe we should say side-effect free expressions) is related to the
> sound principle of command-query separation.
>

Also: C++ allows a function call that returns a reference on the
left side of an assignment. This the statements:

int & something(int bar);

if (something(4) = 3) {
}

would NOT be an error, although it is not obvious what is going on.

> August
>

--
Robert Heller -- 978-544-6933 / heller(at)deepsoft(dot)com
Deepwoods Software -- http://www.deepsoft.com/
() ascii ribbon campaign -- against html e-mail
/\ www.asciiribbon.org -- against proprietary attachments
Re: Nasty language semantics (Was: error message I don understand) [message #174912 is a reply to message #174909] Sun, 17 July 2011 19:23 Go to previous messageGo to next message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma: 0
Senior Member
In article <ivv775$egh$1(at)dont-email(dot)me>,
August Karlstrom <fusionfile(at)gmail(dot)com> wrote:

> On 2011-07-17 18:31, Peter H. Coffin wrote:
>> On Sun, 17 Jul 2011 16:50:28 +0200, August Karlstrom wrote:
>>
>>> On 2011-07-17 15:03, Jerry Stuckle wrote:
>>>
>>>> This isn't mathematics - it is programming, as people have told you
>>>> before. If you want mathematics, get a chalkboard.
>>>
>>> Don't be silly. There are several programming languages in which `='
>>> denote (surprise) equality.
>>
>> Very few that use it alone.
>
> Pascal, Modula-2, Eiffel and Ada all use `=' for equality and `:=' for
> assignment.

A good enough reason not to use these languages.

--
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
Re: Nasty language semantics (Was: error message I don understand) [message #174913 is a reply to message #174912] Sun, 17 July 2011 19:50 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
Tim Streater wrote:
> In article <ivv775$egh$1(at)dont-email(dot)me>,
> August Karlstrom <fusionfile(at)gmail(dot)com> wrote:
>
>> On 2011-07-17 18:31, Peter H. Coffin wrote:
>>> On Sun, 17 Jul 2011 16:50:28 +0200, August Karlstrom wrote:
>>>
>>>> On 2011-07-17 15:03, Jerry Stuckle wrote:
>>>>
>>>> > This isn't mathematics - it is programming, as people have told you
>>>> > before. If you want mathematics, get a chalkboard.
>>>>
>>>> Don't be silly. There are several programming languages in which `='
>>>> denote (surprise) equality.
>>>
>>> Very few that use it alone.
>>
>> Pascal, Modula-2, Eiffel and Ada all use `=' for equality and `:=' for
>> assignment.
>
> A good enough reason not to use these languages.
>

The chief reason I gave up on Pascal after spending 4 hours trying to
make a variable length bitfield containing potentially different sorts
of entities depending on what was in the first few bits...into some form
of syntax that made it usable, was that in the end rewriting the whole
program in C was quicker than trying to make the existing Pascal work.

And that's the problem with these academic languages. When you meet a
situation never envisaged in the academics brain that created them, you
are basically shafted.

I don't care what the actual syntax is. AS long as its clear unambiguous
and consistent.


Since I write assignment more often than comparisons, I slightly prefer
a=b as the assignment and a==b as the boolean comparison.

Aso why I hate loosely typed languages.

I want to know that '1.02' + '3.7' is reliably going to be either '4.72'
or '1.023.7', not implementation dependent, as I found in at least one
Javascript example.
Re: Nasty language semantics (Was: error message I don understand) [message #174914 is a reply to message #174913] Sun, 17 July 2011 20:17 Go to previous messageGo to next message
Robert Heller is currently offline  Robert Heller
Messages: 60
Registered: December 2010
Karma: 0
Member
At Sun, 17 Jul 2011 20:50:23 +0100 The Natural Philosopher <tnp(at)invalid(dot)invalid> wrote:

>
> Tim Streater wrote:
>> In article <ivv775$egh$1(at)dont-email(dot)me>,
>> August Karlstrom <fusionfile(at)gmail(dot)com> wrote:
>>
>>> On 2011-07-17 18:31, Peter H. Coffin wrote:
>>>> On Sun, 17 Jul 2011 16:50:28 +0200, August Karlstrom wrote:
>>>>
>>>> > On 2011-07-17 15:03, Jerry Stuckle wrote:
>>>> >
>>>> >> This isn't mathematics - it is programming, as people have told you
>>>> >> before. If you want mathematics, get a chalkboard.
>>>> >
>>>> > Don't be silly. There are several programming languages in which `='
>>>> > denote (surprise) equality.
>>>>
>>>> Very few that use it alone.
>>>
>>> Pascal, Modula-2, Eiffel and Ada all use `=' for equality and `:=' for
>>> assignment.
>>
>> A good enough reason not to use these languages.
>>
>
> The chief reason I gave up on Pascal after spending 4 hours trying to
> make a variable length bitfield containing potentially different sorts
> of entities depending on what was in the first few bits...into some form
> of syntax that made it usable, was that in the end rewriting the whole
> program in C was quicker than trying to make the existing Pascal work.
>
> And that's the problem with these academic languages. When you meet a
> situation never envisaged in the academics brain that created them, you
> are basically shafted.
>
> I don't care what the actual syntax is. AS long as its clear unambiguous
> and consistent.
>
>
> Since I write assignment more often than comparisons, I slightly prefer
> a=b as the assignment and a==b as the boolean comparison.
>
> Aso why I hate loosely typed languages.
>
> I want to know that '1.02' + '3.7' is reliably going to be either '4.72'
> or '1.023.7', not implementation dependent, as I found in at least one
> Javascript example.

Javascript's main problem here is using a common numerical operator (+)
as a string operator as will AND allowing numbers to promoted (or
demoted) to strings. Javascript *could* have picked a different
operator for string concatenation, something less likely to cause
ambigious interpretation.

>

--
Robert Heller -- 978-544-6933 / heller(at)deepsoft(dot)com
Deepwoods Software -- http://www.deepsoft.com/
() ascii ribbon campaign -- against html e-mail
/\ www.asciiribbon.org -- against proprietary attachments
Re: Nasty language semantics (Was: error message I don understand) [message #174915 is a reply to message #174914] Sun, 17 July 2011 20:21 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
Robert Heller wrote:
> At Sun, 17 Jul 2011 20:50:23 +0100 The Natural Philosopher <tnp(at)invalid(dot)invalid> wrote:
>
>> Tim Streater wrote:
>>> In article <ivv775$egh$1(at)dont-email(dot)me>,
>>> August Karlstrom <fusionfile(at)gmail(dot)com> wrote:
>>>
>>>> On 2011-07-17 18:31, Peter H. Coffin wrote:
>>>> > On Sun, 17 Jul 2011 16:50:28 +0200, August Karlstrom wrote:
>>>> >
>>>> >> On 2011-07-17 15:03, Jerry Stuckle wrote:
>>>> >>
>>>> >>> This isn't mathematics - it is programming, as people have told you
>>>> >>> before. If you want mathematics, get a chalkboard.
>>>> >> Don't be silly. There are several programming languages in which `='
>>>> >> denote (surprise) equality.
>>>> > Very few that use it alone.
>>>> Pascal, Modula-2, Eiffel and Ada all use `=' for equality and `:=' for
>>>> assignment.
>>> A good enough reason not to use these languages.
>>>
>> The chief reason I gave up on Pascal after spending 4 hours trying to
>> make a variable length bitfield containing potentially different sorts
>> of entities depending on what was in the first few bits...into some form
>> of syntax that made it usable, was that in the end rewriting the whole
>> program in C was quicker than trying to make the existing Pascal work.
>>
>> And that's the problem with these academic languages. When you meet a
>> situation never envisaged in the academics brain that created them, you
>> are basically shafted.
>>
>> I don't care what the actual syntax is. AS long as its clear unambiguous
>> and consistent.
>>
>>
>> Since I write assignment more often than comparisons, I slightly prefer
>> a=b as the assignment and a==b as the boolean comparison.
>>
>> Aso why I hate loosely typed languages.
>>
>> I want to know that '1.02' + '3.7' is reliably going to be either '4.72'
>> or '1.023.7', not implementation dependent, as I found in at least one
>> Javascript example.
>
> Javascript's main problem here is using a common numerical operator (+)
> as a string operator as will AND allowing numbers to promoted (or
> demoted) to strings. Javascript *could* have picked a different
> operator for string concatenation, something less likely to cause
> ambigious interpretation.
>
Or they could have defined the language carefully enough so that it was
unambiguous, or allowed for explicit casting to make it so.


>>
>
Re: Nasty language semantics (Was: error message I don understand) [message #174916 is a reply to message #174913] Sun, 17 July 2011 22:06 Go to previous messageGo to next message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma: 0
Senior Member
In article <ivvee0$eqg$1(at)news(dot)albasani(dot)net>,
The Natural Philosopher <tnp(at)invalid(dot)invalid> wrote:

> Tim Streater wrote:
>> In article <ivv775$egh$1(at)dont-email(dot)me>,
>> August Karlstrom <fusionfile(at)gmail(dot)com> wrote:
>>
>>> On 2011-07-17 18:31, Peter H. Coffin wrote:
>>>> On Sun, 17 Jul 2011 16:50:28 +0200, August Karlstrom wrote:
>>>>
>>>> > On 2011-07-17 15:03, Jerry Stuckle wrote:
>>>> >
>>>> >> This isn't mathematics - it is programming, as people have told you
>>>> >> before. If you want mathematics, get a chalkboard.
>>>> >
>>>> > Don't be silly. There are several programming languages in which `='
>>>> > denote (surprise) equality.
>>>>
>>>> Very few that use it alone.
>>>
>>> Pascal, Modula-2, Eiffel and Ada all use `=' for equality and `:=' for
>>> assignment.
>>
>> A good enough reason not to use these languages.
>
> The chief reason I gave up on Pascal after spending 4 hours trying to
> make a variable length bitfield containing potentially different sorts
> of entities depending on what was in the first few bits...into some form
> of syntax that made it usable, was that in the end rewriting the whole
> program in C was quicker than trying to make the existing Pascal work.
>
> And that's the problem with these academic languages. When you meet a
> situation never envisaged in the academics brain that created them, you
> are basically shafted.

Pascal was not originally intended for other than academic use. As
designed and implemented by Wirth, you couldn't even do compilation of
separate modules for later linking together. Trouble is, students who
learnt it then decided it was wonderful, went out into the wide world,
and persuaded clueless software managers that this was the language to
make more widely available.

Its worst defect was that strings of different lengths were different
types. Also at the time academics were pushing the
single-entry-single-exit bullshit, so there was no return statement.

It ended up as a plethora of different implementations, all getting
around the limitations in different incompatible ways, which is probably
what did for it.

--
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
Re: Nasty language semantics (Was: error message I don understand) [message #174917 is a reply to message #174916] Sun, 17 July 2011 22:48 Go to previous messageGo to next message
August Karlstrom is currently offline  August Karlstrom
Messages: 16
Registered: October 2010
Karma: 0
Junior Member
On 2011-07-18 00:06, Tim Streater wrote:
> Also at the time academics were pushing the
> single-entry-single-exit bullshit, so there was no return statement.

I guess a certain level of maturity is required to appreciate some of
these "restrictions". The return statement goes against the idea of a
truly structured goto-less programming language. Wirth introduced the
return statement (tried it) in Modula-2 and in the first versions of
Oberon but replaced it with a return clause (single exit point) in
Oberon-07. Here is a quote by Niklaus Wirth from "Differences between
Oberon-07 and Oberon"*:

"The result of a function procedure was specified by a return statement.
This form has the unpleasant property that the return statement is
syntactically disconnected from the function procedure declaration,
similar to the exit from the loop statements. It is therefore difficult
to check, whether or not a function procedure declaration specifies a
result, or perhaps even several of them. Now the result specification
becomes syntactically a part of the procedure declaration, and vanishes
as an independent statement form."


August


*http://www.inf.ethz.ch/personal/wirth/Articles/Oberon/Oberon07.pdf

--
The competent programmer is fully aware of the limited size of his own
skull. He therefore approaches his task with full humility, and avoids
clever tricks like the plague. --Edsger Dijkstra
Re: Nasty language semantics (Was: error message I don understand) [message #174918 is a reply to message #174917] Sun, 17 July 2011 23:23 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 7/17/2011 6:48 PM, August Karlstrom wrote:
> On 2011-07-18 00:06, Tim Streater wrote:
>> Also at the time academics were pushing the
>> single-entry-single-exit bullshit, so there was no return statement.
>
> I guess a certain level of maturity is required to appreciate some of
> these "restrictions". The return statement goes against the idea of a
> truly structured goto-less programming language. Wirth introduced the
> return statement (tried it) in Modula-2 and in the first versions of
> Oberon but replaced it with a return clause (single exit point) in
> Oberon-07. Here is a quote by Niklaus Wirth from "Differences between
> Oberon-07 and Oberon"*:
>
<snip>
>
>
> August
>
>
> *http://www.inf.ethz.ch/personal/wirth/Articles/Oberon/Oberon07.pdf
>

I guess a certain level of maturity is needed to recognize an academic
language from one which is truly usable in the real world.

My guess is you've never worked on a real multi-programmer project in a
business environment. Or maybe not even a single-programmer project in
a corporate environment.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: Nasty language semantics (Was: error message I don understand) [message #174919 is a reply to message #174918] Sun, 17 July 2011 23:51 Go to previous messageGo to previous message
August Karlstrom is currently offline  August Karlstrom
Messages: 16
Registered: October 2010
Karma: 0
Junior Member
On 2011-07-18 01:23, Jerry Stuckle wrote:
> I guess a certain level of maturity is needed to recognize an academic
> language from one which is truly usable in the real world.
>
> My guess is you've never worked on a real multi-programmer project in a
> business environment. Or maybe not even a single-programmer project in a
> corporate environment.

I have worked in all kinds of constellations and seldom have I
experienced a problem with the language at hand being too restrictive,
quite on the contrary, obscure language features in combination with
programmer "cleverness" (in the usual "power corrupts" sense) have given
rise to several maintenance headaches.

August

--
The competent programmer is fully aware of the limited size of his own
skull. He therefore approaches his task with full humility, and avoids
clever tricks like the plague. --Edsger Dijkstra
Pages (2): [1  2    »]  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Ouion Movement, Roun Time (Floating Point Time)
Next Topic: [MEMCACHED] Is there a way to get the expiration of a key?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 12:44:52 GMT 2024

Total time taken to generate the page: 0.03395 seconds