Removed autocasting strings
Re: Removed autocasting strings
Actually, disallowing autocasting of pointers makes sens, as you hardly need it unless you are doing very specific debugging.
Re: Removed autocasting strings
If there will be a option to disallow auto-casting in future, it would make sense to do this in code and not in the preferences. So there will be no problem to use posted code from the forum.Fred wrote:Actually, disallowing autocasting of pointers makes sens, as you hardly need it unless you are doing very specific debugging.
I'm thinking a parameter or flag for different security levels expanding the EnableExplicit directive would make sense.
sorry for my bad english
Re: Removed autocasting strings
It is not a problem with pointers only. I think you have luis' example in mind: Write *p where you wanted to write *p\s.Fred wrote:Actually, disallowing autocasting of pointers makes sens, as you hardly need it unless you are doing very specific debugging.
It could be a typo, but this can also happen with structures. Not for string concatenation, generally.
Code: Select all
EnableExplicit
Structure Items
b.b
EndStructure
Structure Entity
*p.Byte
b.Items[10]
EndStructure
Define the.Entity
Define byt.b = 12
If byt = the ; compare byte (.b) with Structure?
Debug "1"
EndIf
If byt = the\b[5] ; compare byte (.b) with Structure?
Debug "2"
EndIf
If byt = the\p ; compare byte (.b) with Pointer?
Debug "3"
EndIf
If byt = the\b[5]\b ; compare byte (.b) with byte (.b), correct
Debug "4"
EndIf
If the\p <> 0 And byt = the\p\b ; compare byte (.b) with byte (.b), correct
Debug "5"
EndIf
Writing *p or x but wanting to write *p\s and x\b can happen everywhere, not for string concatenation only.
Maybe it would be better to allow everything by default (like it is now) for prototyping
and check EVERYTHING with EnableExplicit. In the case of auto-casting to string,
EnableExplicit would mean to have explicitely to use Str().

-
- Addict
- Posts: 4779
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: Removed autocasting strings
Absolutely!Josh wrote:If there will be a option to disallow auto-casting in future, it would make sense to do this in code and not in the preferences.
I understand what you are saying, but I think then there still will be problems with using posted code from the forum.Josh wrote:So there will be no problem to use posted code from the forum.
Say there will be the keywords "EnableStringAutocasting" and "DisableStringAutocasting". People might use them at the beginning of their main source code file, before any "Include" statement. Then they'll post e.g. a snippet from an include file, which as a small isolated piece of code will not work the same way as in the original context, with "EnableStringAutocasting" or "DisableStringAutocasting" in effect. IMHO this has the potential to cause much confusion.
Re: Removed autocasting strings
I take back my request to remove the "auto casting".
I like the idea with the "EnableAutocasting, DisableAutocasting".
I first discovered PureBasic for my hobby. In the meantime I use purebasic for special requirements in the industrial application where there are no ready for solving approaches.
The development time of these special applications with purebasic very short.
My request to the PureBasic Team which is the bug reports are processed before any other wish.
Thank you for the best native compiler for all standard OS
Thanks to google translater
I like the idea with the "EnableAutocasting, DisableAutocasting".
I first discovered PureBasic for my hobby. In the meantime I use purebasic for special requirements in the industrial application where there are no ready for solving approaches.
The development time of these special applications with purebasic very short.
My request to the PureBasic Team which is the bug reports are processed before any other wish.
Thank you for the best native compiler for all standard OS

Thanks to google translater
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
-
- Addict
- Posts: 4779
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: Removed autocasting strings
Then I'll maintain the request.mk-soft wrote:I take back my request to remove the "auto casting".

-
- Enthusiast
- Posts: 252
- Joined: Mon Aug 16, 2010 4:29 am
Re: Removed autocasting strings
Making new functionality optional when changing existing commands is easier on users, however, having said that...
If you start Debug with a string, you get autocasting. If you don't, you don't. I like it.
If you start Debug with a string, you get autocasting. If you don't, you don't. I like it.