Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pete's Dumb Idea of the Day!
#11
(10-21-2024, 10:15 PM)TempodiBasic Wrote:
(10-21-2024, 07:53 PM)Pete Wrote: Wouldn't it be nice to have this feature for Data Restore?

On x Restore data1, data2, data3

instead of needing to code...

Select Case x
Case 1: Restore data1
Case 2: Restore data2
Case 3: Restore data3
End Select
Hi Pete
what do you think about this alternative solution?

Code: (Select All)

Rem  demo Restore : On x Restore idea

For x = 1 To 4
    On x GOSUB data1, data2, data3, data4
    Read number, nam$, Order$
    Print number, nam$, Order$
Next
I prefer something like TempodiBasic's solution to Pete's because it avoids one thing: adding "proprietary" extensions to the language. (I offer a simple alternative solution later in this posting.) Yes, I know QB64PE is open source, but I'm using it in a more classic sense: when one compiler/interpreter adds new features to the language, new keywords, new operators, etc. This now means that programs using that dialect of the language can't port it to a different compiler. Which can defeat the whole purpose of using a standard language. Which can lead to other issues. I have a bit of a long story to explain why it's not a good idea.

Up until the late 1980s or possibly the 1990s, what was the most popular programming language in the world? I would say, hands down, no question, it was COBOL. Since up until the early 1980s there were no microcomputers other than ones intended for hobbyists, experimenters and home use. Business use was very rare. So what businesses had, were minicomputers and mainframes. And what programming language was available on all of them, in essentially the same dialect? That's right, COBOL.

The reason being was in the mid 1950s, the U.S. Department of Defense (DOD) was sick and tired of having thousands of computers using dozens or hundreds of programming languages, and wanted one it could standardize on. So, in 1959, a committee was formed to develop one, led by Dr. Grace Hopper. Hopper, who then was a lieutenant in the U.S. Navy, aggressively pushed for the development of a standardized language that ordinary people could use, and would make business sense for use by civilian businesses. This became COBOL. Now, effectively every major computer manufacturer was involved in this, but for new ones, how to get them to offer the language? Very simple. The DOD announced that they would not buy any new computer unless it had a COBOL compiler.

Now, everybody having a COBOL compiler was fine for the government, for the manufacturer, how do you distinguish your computer from everyone else's? Well, add new features and add proprietary enhancements to the COBOL compiler to take advantage of them. Well, this means programs again are being made non-transportable to other company's machines, so then the DOD promulgated a new rule: to be able to sell to them, your COBOL compiler had to be able to process ANSI Standard Cobol, and while you could still offer proprietary extensions, there had to be a compile-time switch to tell the compiler to accept programs that only used the standard language, and flag non-standard usage.

So even 60+ years ago it was understood that adding special features makes it difficult to move programs elsewhere. Please do not fall for the siren song of adding "just to be nice" features when existing ones will do the job.

And now, as I mentioned earlier, my suggestion on a solution:

Code: (Select All)

Rem  demo Restore : On x Restore idea

For x = 1 To 4
   select case x
      case 1: restore data1
      case 2: restore data2
      case 3: restore data3
      case 4: restore data4
   end select
   Read number, nam$, Order$
    Print number, nam$, Order$
Next
Maybe I'm different, but I think it's simpler to understand, easier to implement, and keeps everything happening together in one place.
While 1
   Fix Bugs
   report all bugs fixed
   receive bug report
end while
Reply


Messages In This Thread
Pete's Dumb Idea of the Day! - by Pete - 10-21-2024, 07:53 PM
RE: Pete's Dumb Idea of the Day! - by TDarcos - 10-23-2024, 02:47 AM
RE: Pete's Dumb Idea of the Day! - by CharlieJV - 10-22-2024, 12:01 AM
RE: Pete's Dumb Idea of the Day! - by dano - 10-22-2024, 01:08 AM
RE: Pete's Dumb Idea of the Day! - by Pete - 10-22-2024, 05:55 AM
RE: Pete's Dumb Idea of the Day! - by bplus - 10-22-2024, 10:40 AM
RE: Pete's Dumb Idea of the Day! - by a740g - 10-22-2024, 11:46 AM
RE: Pete's Dumb Idea of the Day! - by Petr - 10-22-2024, 03:57 PM
RE: Pete's Dumb Idea of the Day! - by Pete - 10-23-2024, 01:01 AM
RE: Pete's Dumb Idea of the Day! - by SMcNeill - 10-23-2024, 03:54 AM
RE: Pete's Dumb Idea of the Day! - by Pete - 10-23-2024, 07:59 AM
RE: Pete's Dumb Idea of the Day! - by CharlieJV - 10-23-2024, 01:07 PM
RE: Pete's Dumb Idea of the Day! - by Pete - 10-23-2024, 05:37 PM
RE: Pete's Dumb Idea of the Day! - by CharlieJV - 10-23-2024, 08:09 PM
RE: Pete's Dumb Idea of the Day! - by Pete - 10-23-2024, 10:29 PM



Users browsing this thread: 12 Guest(s)