December 01, 2020, 06:18:16 PM

Author Topic: can we bring back The Goto and #label commands into NG  (Read 1390 times)

Offline wadmixfm

  • Jr. Member
  • **
  • Posts: 64
can we bring back The Goto and #label commands into NG
« on: August 12, 2020, 11:30:32 AM »
would it be possible for us novices to have the old commands back ????

goto and the #label commands were great and simple

now you have to write upto 20 more lines of code to get it to do a simple jump to a line.

in machine language they use the Jmp command and no one complains

isnt it down to the end user if we would like these features or not

could you add a switch in the ide to turn it on or off for example

Lee

 :D :D :D :D :D :D

Offline GfK

  • Full Member
  • ***
  • Posts: 164
Re: can we bring back The Goto and #label commands into NG
« Reply #1 on: August 12, 2020, 11:45:03 AM »
Cannot think of a single scenario where you would ever need goto/gosub - even less so one that would require a 20-line work-around.

I think you're asking for features that you understand, to stand in for the ones you just haven't learned about yet
Intel I9-9900K 3.6-5.0GHz | GeForce RTX2070 8GB | 32GB RAM | 500GB NVMe M.2 SSD | 1TB HDD | Windows 10 x64.
MSI Apache Pro | I7-7700HQ | GeForce GTX1060 3GB | 8GB RAM | 128GB SSD | 1TB HDD | Windows 10 x64.

Offline wadmixfm

  • Jr. Member
  • **
  • Posts: 64
Re: can we bring back The Goto and #label commands into NG
« Reply #2 on: August 12, 2020, 12:03:06 PM »
no i understand it perfectly , but i cant see why two little commands have been taken away
which are not damaging the size of blitzmax source ,i have been working on a few old programs from the vanilla days of blitzmax and its a lot of code to be going through converting the goto's and the labels.

its down to the user if they want to use them or not right ???

so why not leave them in ??

so people that still want to use them can do

you dont go into a shop and buy a pencil and the shop keeper says you cant use that to draw with.


Offline wadmixfm

  • Jr. Member
  • **
  • Posts: 64
Re: can we bring back The Goto and #label commands into NG
« Reply #3 on: August 12, 2020, 12:05:12 PM »
all i want to do is convert my programs to run in 64 bit and doing this i need to use NG i like the look of NG but taking things away is not the way forward for me anyways.


Offline GfK

  • Full Member
  • ***
  • Posts: 164
Re: can we bring back The Goto and #label commands into NG
« Reply #4 on: August 12, 2020, 12:10:33 PM »
no i understand it perfectly , but i cant see why two little commands have been taken away
Because they are obsolete.  They simply aren't needed in object-oriented code.

Quote
its down to the user if they want to use them or not right ???
Well, they've been removed.  So, no.

Quote
you dont go into a shop and buy a pencil and the shop keeper says you cant use that to draw with.
But pencils are still pretty much the best option for drawing with.  In fact if you went into a shop and asked for a bundle of twigs and some fire so you could scratch your doodles into a cave wall, a pencil would probably be recommended to you.
Intel I9-9900K 3.6-5.0GHz | GeForce RTX2070 8GB | 32GB RAM | 500GB NVMe M.2 SSD | 1TB HDD | Windows 10 x64.
MSI Apache Pro | I7-7700HQ | GeForce GTX1060 3GB | 8GB RAM | 128GB SSD | 1TB HDD | Windows 10 x64.

Offline wadmixfm

  • Jr. Member
  • **
  • Posts: 64
Re: can we bring back The Goto and #label commands into NG
« Reply #5 on: August 12, 2020, 12:21:03 PM »
why dont they write a mod for it for user to have if they want it??

another scenario

i have just bought a new car and it had overdrive  , but my car went in for a service and you removed it , but i still want to use it , why did you take it away ???

i paid 80$ for blitzmax and i am not getting the service i paid for
if i want these feature dont i have a right to have them ??

 

Offline wadmixfm

  • Jr. Member
  • **
  • Posts: 64
Re: can we bring back The Goto and #label commands into NG
« Reply #6 on: August 12, 2020, 12:30:36 PM »
and explain to me why the goto command is still in the commands list and it still shows the example oh how to use it

i feel the option has been disabled in the compiler (bcc)

just recently learned about this file in the source code
there is a restriction in the compiler code to stop goto correct ??

   stm.cpp
   Removed restriction which didn't allow Goto in strict mode


Offline wadmixfm

  • Jr. Member
  • **
  • Posts: 64
Re: can we bring back The Goto and #label commands into NG
« Reply #7 on: August 12, 2020, 12:32:01 PM »
ok if you cant bring it back is there a 64bit port of blitzmax ???


Online Steve Elliott

  • Hero Member
  • *****
  • Posts: 2870
  • elgol 2021
Re: can we bring back The Goto and #label commands into NG
« Reply #8 on: August 12, 2020, 12:45:42 PM »
First of all Blitzmax was abandoned by the author and left open source.  So complaining you're not getting the service you paid for is well, tough.  Mr Mark Sibly walked away from BlitzMax so it no longer exists.  Brucey worked hard to bring a new 64-bit version called BlizMax NG or it would have died completely.

Using the Goto command and jumping about all over the place is bad programming practice in a structured or object oriented language, so I can understand why Brucey removed it.  Mark made the mistake of allowing all sorts programming styles to mix, and with all that strict, super strict nonsense too.  So people like yourself can quite rightly feel annoyed because the original author allowed everybody to do whatever they want, rather than being sensible and putting in a standard syntax for everybody to follow.
Windows 10 64-bit, 16Gb RAM, Intel i5 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
MacOS Big Sur 64-bit, 8Gb RAM, Intel i5 2.3 Ghz, Intel Iris Plus Graphics 640 1536 MB
Linux Mint 19.3 64-bit, 16Gb RAM, Intel i5 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb)
Raspberry Pi 400, Pi4, C64, ZX Spectrum Next.

Offline wadmixfm

  • Jr. Member
  • **
  • Posts: 64
Re: can we bring back The Goto and #label commands into NG
« Reply #9 on: August 12, 2020, 01:05:00 PM »
so again for us novices that dont do this kind of thing day in day out

whats the alternative to goto and labels

my old programs work fine in 32 bit mode no lag or slow down no memory leaks and i can also when it came too debugging errors could always find where i had gone wrong,but i want to update it into the 64 bit market and to migrate onto other platforms like mac os catalina which i know is 64bit also.

typical scenario -

local me
for i = 1 to 1000
if i = 500 then me = 500 then goto me2
next

...... loads more code here say another 1000 lines

#me2
end

i know about functions but you are tied to them as its

function me()
..... do something

end function

then call it

but i have a lot of loops and jump arounds to do

 

Offline GfK

  • Full Member
  • ***
  • Posts: 164
Re: can we bring back The Goto and #label commands into NG
« Reply #10 on: August 12, 2020, 02:08:40 PM »
Quote
i paid 80$ for blitzmax and i am not getting the service i paid for
It's been open-source (and free) for ages now.  So if you paid $80 for it, you must have had it at least six years.  And BlitzMax still works today so nothing has been taken from you, as you seem to be suggesting.

Further, BlitzMaxNG is nothing at all to do with the original creator of BlitzMax.  Brucey (to my knowledge) has not charged anyone a cent for the work he's done on the NG version since.

Bottom line, if you want to use Goto, stick with the last official release of BlitzMax.  That is, after all, what you paid for.
Intel I9-9900K 3.6-5.0GHz | GeForce RTX2070 8GB | 32GB RAM | 500GB NVMe M.2 SSD | 1TB HDD | Windows 10 x64.
MSI Apache Pro | I7-7700HQ | GeForce GTX1060 3GB | 8GB RAM | 128GB SSD | 1TB HDD | Windows 10 x64.

Offline wadmixfm

  • Jr. Member
  • **
  • Posts: 64
Re: can we bring back The Goto and #label commands into NG
« Reply #11 on: August 12, 2020, 02:25:37 PM »
very positive gfk

all i want to know is can i compile my code in 64bit with ease

seems i have to take 20 turns just to execute a simple 2 step operation

i dont want to be rewriting all my code again and yet i want to upgrade to NG and 64bit

is there any solutions apart from the obvious??


Offline GfK

  • Full Member
  • ***
  • Posts: 164
Re: can we bring back The Goto and #label commands into NG
« Reply #12 on: August 12, 2020, 03:17:38 PM »
very positive gfk

all i want to know is can i compile my code in 64bit with ease

seems i have to take 20 turns just to execute a simple 2 step operation

i dont want to be rewriting all my code again and yet i want to upgrade to NG and 64bit

is there any solutions apart from the obvious??
No.  Rewrite your code.  If it's that badly written in the first place that Gotos are required, then a complete rethink should be top of your 'to do' list.


Quote
typical scenario -

local me
for i = 1 to 1000
if i = 500 then me = 500 then goto me2
next

...... loads more code here say another 1000 lines

#me2
end

i know about functions but you are tied to them as its

function me()
..... do something

end function

then call it

but i have a lot of loops and jump arounds to do
Your 'typical scenario' doesn't even make sense.  You have two "then"s on the same line - is that even legal syntax in Blitzmax?  Also you're just ditching the entire loop when you reach 500 anyway, so why set it up for 1,000 iterations?

And to be honest I just gave up trying to comprehend it when you complained that you're "tied to functions".  If you're even avoiding the use of functions, then coding probably isn't for you.
Intel I9-9900K 3.6-5.0GHz | GeForce RTX2070 8GB | 32GB RAM | 500GB NVMe M.2 SSD | 1TB HDD | Windows 10 x64.
MSI Apache Pro | I7-7700HQ | GeForce GTX1060 3GB | 8GB RAM | 128GB SSD | 1TB HDD | Windows 10 x64.

Offline wadmixfm

  • Jr. Member
  • **
  • Posts: 64
Re: can we bring back The Goto and #label commands into NG
« Reply #13 on: August 12, 2020, 04:02:37 PM »
the program i have written in blitzmax works fine

with no errors in 8551 lines of code and no one can help me with a goto alternative

thanks



 

Offline TomToad

  • Hero Member
  • *****
  • Posts: 517
Re: can we bring back The Goto and #label commands into NG
« Reply #14 on: August 12, 2020, 04:14:56 PM »
I am assuming your scenario is a standin for a more complex function, like searching through an array.

One way to do it would be to set me to a default value representing "value not found" and then testing for that value after exiting the loop.  In my example here, I default to -1.
Code: BlitzMax
  1. Local a:Int[] = [1,3,5,7,9]
  2.  
  3. For Local valueToSearch:Int = 1 To 10
  4.         Local me:Int = -1
  5.  
  6.         For Local i:Int = 0 Until a.length
  7.                 If a[i] = valueToSearch
  8.                         me = i
  9.                         Exit
  10.                 EndIf
  11.         Next
  12.  
  13.         If me < 0
  14.                 Print valueToSearch+" was not found"
  15.         Else
  16.                 Print valueToSearch+" was found at index "+me
  17.         EndIf
  18. Next
  19.  

Another way would be to use loop labels with exit and wrap your function in a Repeat/Until block.

Code: BlitzMax
  1. Local a:Int[] = [1,3,5,7,9]
  2.  
  3. For Local valueToSearch:Int = 1 To 10
  4.         Local me:Int = -1
  5.  
  6. #looplabel
  7.         Repeat
  8.                 For Local i:Int = 0 Until a.length
  9.                         If a[i] = valueToSearch
  10.                                 me = i
  11.                                 Exit looplabel
  12.                         EndIf
  13.                 Next
  14.                 Print valueToSearch+" was not found"
  15.         Until True
  16.         If me >= 0
  17.                 Print valueToSearch+" was found at index "+me
  18.         EndIf
  19. Next
  20.  

Of the two, I prefer the first version as it is more clear as to what you are trying to do.

Better than either would be to put the routine in its own function.
Code: BlitzMax
  1. Local a:Int[] = [1,3,5,7,9]
  2.  
  3. For Local valueToSearch:Int = 1 To 10
  4.         Local me:Int = getArrayIndex(a, valueToSearch)
  5.         If me < 0
  6.                 Print valueToSearch+" was not found"
  7.         Else
  8.                 Print valueToSearch+" was found at index "+me
  9.         EndIf
  10. Next
  11.  
  12. Function getArrayIndex:Int(a:Int[], valueToSearch:Int)
  13.         For Local i:Int = 0 Until a.length
  14.                 If a[i] = valueToSearch Then Return i
  15.         Next
  16.         Return -1
  17. End Function
  18.  
This way, the routine can be used multiple times throughout your program, with different arrays and different values, without having to rewrite the same routine over again.
------------------------------------------------
8 rabbits equals 1 rabbyte.

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal