I don't understand what you mean. Are you saying that you think Fred will not be able to implement such an error check correctly?PMV wrote:Bet i will. If fred adds such a warning for some cases, one case
will be a problem for me. He is only a human. Unbelievable,
of course for me too, but thats true. And thats the problem.
Please check for syntax that doesn't make ANY sense
-
- Addict
- Posts: 4779
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: Please show all syntax errors
Re: Please show all syntax errors
If you are not able to see such mistakes on your own, why
should other people be able to do really hard work without mistakes?
If he implements such a logic to check this cases to generate
the warnings like you want, doesn't you think he will make much
much more checks for many more case? And one or two of this
other cases could generate false-positives.
If he has done the work, it is not much more work to make it
deactivateable.
MFG PMV
should other people be able to do really hard work without mistakes?

If he implements such a logic to check this cases to generate
the warnings like you want, doesn't you think he will make much
much more checks for many more case? And one or two of this
other cases could generate false-positives.

If he has done the work, it is not much more work to make it
deactivateable.

MFG PMV
-
- Addict
- Posts: 4779
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: Please show all syntax errors
Fred will probably make several changes to the compiler in the future. We cannot know what these will be.PMV wrote:If he implements such a logic to check this cases to generate
the warnings like you want, doesn't you think he will make much
much more checks for many more case?
This thread is only about the suggestion that I made here. And since you wrote
you will not notice any difference when my suggestion will be implemented.PMV wrote:I haven't done a mistake like this and i will not do it.
Re: Please show all syntax errors
I do not understand the resistence. It is about adding a warning to CERTAIN commands which DEFINITELY require the use of return values.
As such, those commands that might be used otherwise would NOT trigger a warning.
How can such an additional help to the programmer thus cause false warnings??!?
As such, those commands that might be used otherwise would NOT trigger a warning.
How can such an additional help to the programmer thus cause false warnings??!?
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
Re: Please show all syntax errors
The request is so fundamental that it does not compute as a bug.blueznl wrote:How can such an additional help to the programmer thus cause false warnings??!?

Also, I suspect this would only work for PureBasic commands and not user commands, since the resources spent by the compiler trying to define our logic would be a waste. But then it would be inconsistent. So why bother?
I can't support this without a way to quantify how much of a performance penalty there would be at compile time.
I can also imagine the warnings to be annoying.. just another window to close while pouring over test code. "Yes, yes, I know. I just didn't feel like commenting that line" and so fourth.
Re: Please show all syntax errors
Well, here's my view on this whole issue: it's much ado about nothing.
Somebody made a typo in their app, and didn't use a command in the
way the manual says. Now they want a compiler check added, which
will slow down compilation for everyone else because of their typo.
Shouldn't they just learn from their mistake, and not make it again?
Somebody made a typo in their app, and didn't use a command in the
way the manual says. Now they want a compiler check added, which
will slow down compilation for everyone else because of their typo.
Shouldn't they just learn from their mistake, and not make it again?
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.
Re: Please show all syntax errors
You can probably make a case for some additional syntax checking
HOWEVER
I'd prefer they work on things that really advance the language capabilities and leave things like this to the programmers.
Someone want to write a syntax checker? Have at it. There are better uses for Fred's time and abilities.
HOWEVER
I'd prefer they work on things that really advance the language capabilities and leave things like this to the programmers.
Someone want to write a syntax checker? Have at it. There are better uses for Fred's time and abilities.
-
- Addict
- Posts: 4779
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: Please show all syntax errors
I don't understand it, too.blueznl wrote:I do not understand the resistence.
Mistrel wrote:The request is so fundamental
Exactly. I don't consider that fundamental.blueznl wrote:It is about adding a warning to CERTAIN commands which DEFINITELY require the use of return values.
Yes, that's the reason why my suggestion does only refer to built-in commands of PureBasic.Mistrel wrote:Also, I suspect this would only work for PureBasic commands and not user commands,

I doubt that this would make compilation much slower. If that would be the case, I suspect Freak would have mentioned it in his reply. The compiler has got many things to do anyway, this little extra check will probably only be a small percentage.Mistrel wrote:I can't support this without a way to quantify how much of a performance penalty there would be at compile time.
PB wrote:Somebody made a typo in their app, and didn't use a command in the
way the manual says. Now they want a compiler check added, which
will slow down compilation for everyone else because of their typo.

When people try to execute e.g. the following code
Code: Select all
Dim x()
That's useless and ugly. The compiler shouldn't do such a check. I never made such a mistake, and I'm not going to make it. Why don't people just use the command in the way the manual says? Why does anyone need such a compiler check, which will slow down compilation for everyone else because of their typo?

Oh, THE SOLUTION (TM): People should just stop making mistakes.PB wrote:Shouldn't they just learn from their mistake, and not make it again?
Why didn't anyone think of that before?
This is a valid argument. Please note that I neither consider my suggestion "fundamental", nor most important or something. I just wanted to make a small sugesstion, and was rather surprised when I saw what it triggered here. It's anyway Fred's and Freak's decision, how they prioritize all wishes, suggestions, and their own ideas.rsts wrote:There are better uses for Fred's time and abilities.
Re: Please show all syntax errors
Because this is a syntax-error -> the compiler can not create the executableLittle John wrote:When people try to execute e.g. the following codethen PB will raise an error.Code: Select all
Dim x()
That's useless and ugly. The compiler shouldn't do such a check. I never made such a mistake, and I'm not going to make it. Why don't people just use the command in the way the manual says? Why does anyone need such a compiler check, which will slow down compilation for everyone else because of their typo?
because it doesn't know which size the array will have. There is no special check
implemented for this. This is the result of a missing argument expected from
the compiler at this point.
Btw. i doesn't think the compilation would need much more time because of your wish.

And that is, why i made my wish. Thats all.Fred will probably make several changes to the compiler in the future. We cannot know what these will be.

MFG PMV
Re: Please show all syntax errors
If all mainstream C/C++ compilers allow
and and
Why would PureBasic forbids something that is much more sensible? 
And, how many different logical errors could we check for?
Code: Select all
NULL;
Code: Select all
for(;;);
Code: Select all
i = i++;

And, how many different logical errors could we check for?
Registered PureBasic user since 4.50
-
- Addict
- Posts: 4779
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: Please show all syntax errors
I'm not talking about anything "that is much more sensible".Flower wrote:Why would PureBasic forbids something that is much more sensible?
I'm talking about a particular kind of bugs in our programs. PB could help us to find them. This change in PB would not cause any disadvantage.
I kindly ask everyone, to read what I exactly suggested before "replying" here, and to stay on topic!
Re: Please show all syntax errors
But it isn't a bug. I mean, it's a logic error. But that's not really the same thing?
It's like comparing:
It's like comparing:
vs.Whoops. Forgot to remove some old code from here.
Oh, crap. What the heck did I break now!? Nuclear meltdown in 10.. 9.. 8..
-
- Addict
- Posts: 4779
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: Please show all syntax errors
The problem is not forgetting to remove some old code.Mistrel wrote:Whoops. Forgot to remove some old code from here.
The problem arises, when some code is missing.
The correct syntax for Mid() is e.g.
Code: Select all
s$ = Mid(s$, 3)
Code: Select all
s$ =
Something like that happened to me by accident (probably when doing some cut and paste -- I don't remember exactly anymore). This was a bug in my program -- believe it or not.
Re: Please show all syntax errors
Sorry, but that is not true. All returnvalue assignments are optional in PureBasic. Both for procedures and library functions. Using Mid() without a returnvalue is correct syntax by current rules. Whether or not it makes sense is not the point. This is how the rules currently are.Little John wrote:The correct syntax for Mid() is e.g.If the leading partCode: Select all
s$ = Mid(s$, 3)
is missing, then it's not correct syntax anymore.Code: Select all
s$ =
What you are asking for here is a change of syntax rules, which is why it doesn't surprise me that people are resistent to the idea.
quidquid Latine dictum sit altum videtur
-
- Addict
- Posts: 4779
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: Please show all syntax errors
OK, I've changed the thread title fromfreak wrote:Using Mid() without a returnvalue is correct syntax by current rules. Whether or not it makes sense is not the point. This is how the rules currently are.
What you are asking for here is a change of syntax rules, which is why it doesn't surprise me that people are resistent to the idea.
toPlease show all syntax errors
I'm still surprised why people are so resistent to the idea, since my suggested change will not have any negative effect for them.Please check for syntax that doesn't make ANY sense
Regards, Little John