Re: Is there a programming language that is combination of Python and Basic?
On Apr 21, 5:37 am, Ivan Illarionov wrote: > On Apr 18, 3:39 pm, BJörn Lindqvist wrote: > > > I first started programming basic and i don't think it has hurt me much. > > > I can somewhat sympathise with the op, neither python nor any other > > mainstream language can still do this: > > > SCREEN 13 > > PSET 160,100,255 > > This is not true. It's trivial with pygame or equivalent SDL > bindings in other mainstream languages: > > basic.py: > --- > import sys > import pygame > > class BasicInterpreter: > def SCREEN(self, x): > self.surface = pygame.display.set_mode( > (320, 200), pygame.FULLSCREEN, 8) > > def PSET(self, x, y, c): > self.surface.set_at((x, y), c) > pygame.display.flip() > > if __name__ == '__main__' and len(sys.argv) > 1: > basic = BASIC() > with open(sys.argv[1]) as bas: > for line in bas: > eval("basic.%s(%s)" % tuple(x.strip() for x in line.split > (' ', 1))) > while True: > for event in pygame.event.get(): > if event.type in (pygame.QUIT, pygame.KEYDOWN): > sys.exit(0) > > --- > > This will execute your BASIC program. And you did it without Goto? Wow. > > -- > Ivan -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
On Apr 18, 3:39 pm, BJörn Lindqvist wrote: > I first started programming basic and i don't think it has hurt me much. > > I can somewhat sympathise with the op, neither python nor any other > mainstream language can still do this: > > SCREEN 13 > PSET 160,100,255 This is not true. It's trivial with pygame or equivalent SDL bindings in other mainstream languages: basic.py: --- import sys import pygame class BasicInterpreter: def SCREEN(self, x): self.surface = pygame.display.set_mode( (320, 200), pygame.FULLSCREEN, 8) def PSET(self, x, y, c): self.surface.set_at((x, y), c) pygame.display.flip() if __name__ == '__main__' and len(sys.argv) > 1: basic = BASIC() with open(sys.argv[1]) as bas: for line in bas: eval("basic.%s(%s)" % tuple(x.strip() for x in line.split (' ', 1))) while True: for event in pygame.event.get(): if event.type in (pygame.QUIT, pygame.KEYDOWN): sys.exit(0) --- This will execute your BASIC program. -- Ivan -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
I was at DG in the early nineties. A lot of very smart people devised some of these conventions, from hard-earned experience in the kernel and system-level software. I've never been one for "fascist-rules documents", but in DG's case many of the rules made good sense. I'm not advocating one approach over another; just wanted to show an example where some careful thought went into the use of goto. -- david -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
2009/4/20 david : > When I was at Data General, writing C (and a little C++), we had a set > of internal coding conventions that mandated a single return point for > a function. How long ago was that? Or, more relevant, how old was the rule? Or how long earlier had the person who wrote the rule learned their craft? One reason for mandating single exit points was that early flow graph reducers couldn't handle them, but, because of the GOTO equivalents that you give, graphs with multiple exit points /are/ reducible without the exponential blowup that node splitting can cause, so they've been able to handle multiple exits for many years. Of course, your code is equivalent to: int frodo() { int rval = 0; if (bilbo() != 0) rval = -1 else { if (gandalf() != 0) rval = -1 else { /* lots of code here */ } } return rval; } with not a GOTO in sight, and to my mind much clearer logic. If the nesting meant that the indentation was marching off the side of the page I'd refactor the "lots of code here" into an inline helper function. And provided bilbo() and gandalf() don't have side effects, I'd probably rewrite it as: int frodo() { int rval = 0; if ((bilbo() == 0) || (gandalf() == 0) { /* lot's of code here */ } else rval = -1; return rval; } I'd be inclined to do it that way even if multiple exits were allowed; it just seems so much clearer. -- Tim Rowe -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
When I was at Data General, writing C (and a little C++), we had a set of internal coding conventions that mandated a single return point for a function. Goto's were used during error checks to branch to the function exit; something like this: int frodo() { int rval = 0; if (bilbo() != 0) { rval = -1; goto leave; } if (gandalf() != 0) { rval = -1; goto leave; } /* lot's of code here */ leave: return rval; } Made sense to me. -- david -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
2009/4/20 Steven D'Aprano : > Sheesh. Talk about cherry-picking data. Go read my post in it's entirety, > instead of quoting mining out of context. If you still think I'm unaware > of the difference between unstructured GOTOs and structured jumps, or > that I'm defending unstructured GOTOs, then you might have something > useful to contribute. I wasn't cherry picking data, and I did read the entire post. However, looking back through the message base I see that exactly the same text appears in another posting by you, and the /other/ post makes it clear that you know the difference. Sorry for the confusion. -- Tim Rowe -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
baykus wrote: those "lines" as numbered steps or numbered bricks that are sitting on eachother but I see them as timelines or like filmstrips. Anyways it sounds like such a toy programming language does not exists except Arnaud surprisingly efficient code. and I will search my dream somewhere else :) Actually, your dreams have already been implemented in Python. As an april fool's joke. Really. It works, but is so silly and depraved that I'm not going to provide a link. -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
Michael Torrie wrote: http://www.u.arizona.edu/~rubinson/copyright_violations/Go_To_Considered_Harmful.html Somebody better tell the Linux kernel developers about that! They apparently haven't read that yet. Better tell CPU makers too. In assembly it's all gotos. I'm sure you are joking. Using goto for error handling in C is a reasonable practice, Avoiding that for the sake of it would be like, say, avoiding "raise" in python because "a procedure should only have one exit point". -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
On Sun, 19 Apr 2009 23:23:03 +0100, Tim Rowe wrote: > 2009/4/19 Steven D'Aprano : > >> "GOTO, after all, is just a jump, and we use jumps in Python all the >> time: >> >> raise Exception >> break >> continue >> if... elif... else... >> for... else... >> etc." > > So as a syllogism: > P1: GOTO is a jump; > P2: GOTO is bad. > C: Jumps are bad. > > And then by showing the conclusion is false, you believe you have shown > a contradiction? Try looking up "Affirming the consequent"! Sheesh. Talk about cherry-picking data. Go read my post in it's entirety, instead of quoting mining out of context. If you still think I'm unaware of the difference between unstructured GOTOs and structured jumps, or that I'm defending unstructured GOTOs, then you might have something useful to contribute. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
2009/4/19 Steven D'Aprano : > "GOTO, after all, is just a jump, and we use jumps in Python all the time: > > raise Exception > break > continue > if... elif... else... > for... else... > etc." So as a syllogism: P1: GOTO is a jump; P2: GOTO is bad. C: Jumps are bad. And then by showing the conclusion is false, you believe you have shown a contradiction? Try looking up "Affirming the consequent"! GOTO is an /unstructured/ jump. Raise, break, continue, if, for and so an are all /structured/ jumps. -- Tim Rowe -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
On Sun, 19 Apr 2009 09:09:07 -0400, D'Arcy J.M. Cain wrote: > On Sun, 19 Apr 2009 05:08:32 GMT > Zaphod wrote: >> Friend of mine made a really nice asm development environment for his >> home made OS. Too bad he didn't have any marketing skills. > > Was your friend's name Gary Kildall? :-) Nope - Craig Carmichael. The OS was originally called OMEN but later changed to Oases and was initially designed to run on 68k based machines. Craig just loves 68k assembly - less hair pulling required than x86. -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
I started my commercial programming in Business Basic, (actually MAI Basic 4, and it's equivalent on primos (can't think of it's name at the moment) then later BBX (Basis) We ran the same code (all development on MAI, and then translated the few differences programatically between MAI and Prime) and moved the code via 1/4" tape to prime. This was general ledger, policy and claims systems for an Insurance Broker, we had about 300 + users on the two machines running over a wide area serial network) Then we moved to BBX on Unix. Whilst we had goto, no such thing as string arrays (until BBX) etc we really formally codified all of our devlopment standards, such that even line number ranges where for specific tasks (we had a limit of 64K per program, 1 - for line numbers) and all initialisation had to be in lines 1000 - 1099. We where only allowed to use goto within a routine and only as a last resort,. We could only have one return from a gosub, etc. on mai we could only have two letter or letter and digit variable names and they where global for the probram so if you wanted loop local, or subroutine variables you could safely use then x[1-9] and y[1-9] where safe, all initialisation setup use i[1-9] etc There where 3 programmers and we had to peer review everything. We built rock solid systems, if I say so myself ;-) You can write well structured and easily understood code in any language, it just takes more discipline in some environments more than others. Having said that I would hate to go back to it from Python ;-) See ya T On Apr 18, 4:52 am, a...@pythoncraft.com (Aahz) wrote: > In article > , > > baykus wrote: > > >I am looking for one of those experimental languages that might be > >combination of python+basic. Now thta sounds weird and awkward I know. > >The reason I am asking is that I always liked how I could reference- > >call certain line number back in the days. It would be interesting to > >get similar functionality in Python. > > Why do you want to do that? Before you answer, make sure to read this: > > http://www.u.arizona.edu/~rubinson/copyright_violations/Go_To_Conside... > -- > Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ > > "If you think it's expensive to hire a professional to do the job, wait > until you hire an amateur." --Red Adair -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
On Sun, 19 Apr 2009 05:08:32 GMT Zaphod wrote: > Friend of mine made a really nice asm development environment for his > home made OS. Too bad he didn't have any marketing skills. Was your friend's name Gary Kildall? :-) -- D'Arcy J.M. Cain | Democracy is three wolves http://www.druid.net/darcy/| and a sheep voting on +1 416 425 1212 (DoD#0082)(eNTP) | what's for dinner. -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
On Sun, 2009-04-19 at 06:26 +, Steven D'Aprano wrote: > > (btw, how come nobody has mentioned python bytecode? Most flow > control is jumps) > > > I wrote yesterday: > > "GOTO, after all, is just a jump, and we use jumps in Python all the > time: > > raise Exception > break > continue > if... elif... else... > for... else... > etc." Ah - apologies Tim -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
On Sun, 19 Apr 2009 06:33:23 +0100, Tim Wintle wrote: > On Sun, 2009-04-19 at 05:08 +, Zaphod wrote: >> Well, most of the Linux kernel is written in C and while there *is* a >> jump (often JMP) in most asms, you should only do so if you really need >> to. JSR (jump sub routine) is a better idea in many (most?) cases. > > Have to say that I feel jump is more than justified in some situations > (when it's jumping to within 10-20 lines of the start position, and it's > a routine that needs to be highly optimised - I'm thinking tail > recursion etc.) > > (btw, how come nobody has mentioned python bytecode? Most flow control > is jumps) I wrote yesterday: "GOTO, after all, is just a jump, and we use jumps in Python all the time: raise Exception break continue if... elif... else... for... else... etc." -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
On Sun, 2009-04-19 at 05:08 +, Zaphod wrote: > Well, most of the Linux kernel is written in C and while there *is* a > jump (often JMP) in most asms, you should only do so if you really > need > to. JSR (jump sub routine) is a better idea in many (most?) cases. Have to say that I feel jump is more than justified in some situations (when it's jumping to within 10-20 lines of the start position, and it's a routine that needs to be highly optimised - I'm thinking tail recursion etc.) (btw, how come nobody has mentioned python bytecode? Most flow control is jumps) Tim Wintle -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
On Fri, 17 Apr 2009 16:07:10 -0600, Michael Torrie wrote: > Aahz wrote: >> Why do you want to do that? Before you answer, make sure to read this: >> > http://www.u.arizona.edu/~rubinson/copyright_violations/ Go_To_Considered_Harmful.html > > Somebody better tell the Linux kernel developers about that! They > apparently haven't read that yet. Better tell CPU makers too. In > assembly it's all gotos. Well, most of the Linux kernel is written in C and while there *is* a jump (often JMP) in most asms, you should only do so if you really need to. JSR (jump sub routine) is a better idea in many (most?) cases. You can write really nice structured assembly just as you can with most languages - depending on the assembly language, platform, etc. GOTO is still generally a bad idea, and most of the people that use it can't tell the difference between a good and a bad time to use it. Friend of mine made a really nice asm development environment for his home made OS. Too bad he didn't have any marketing skills. -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
Stef Mientki wrote: > BJörn Lindqvist wrote: >> SCREEN 13 >> PSET 160,100,255 > > Maybe, who is able to understand such nosense without a lot of apriori > knowledge ? You already needed that sort of knowledge to be able to use a computer back then... ;-) -- JanC -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
baykus wrote: Hi I am looking for one of those experimental languages that might be combination of python+basic. Now thta sounds weird and awkward I know. The reason I am asking is that I always liked how I could reference- call certain line number back in the days. It would be interesting to get similar functionality in Python. Apart from the fact that there are basic dialects w/o linenumbers as all, what would it buy you? Keep in mind that if you edit blocks, linenumbers can shift (or you end up starting with 10 spaced numbering and then put lines inbetween). Anyway, do you have any example of what you would do in such a hypothetical language? Tino. -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
2009/4/18 Aahz : > I had never previously heard that Modula-2 significantly > influenced Ada, and the Wikipedia entry says nothing about it. Do you > have a cite? Not in writing. I got it from a SPARK user group meeting many years ago. SPARK is, of course a subset of Ada with some mandatory structured comments, and is a successor to SPADE which was much the same thing for Pascal. When somebody asked one of the SPARK team -- I think it was Denton Clutterbuck -- why they'd gone from Pascal to Ada rather than Modula2, he observed "If you look at the SPARK subset you'll see that it pretty much *is* Modula2". So whether Modula2 was a direct influence or not, it seems to have found its way in. -- Tim Rowe -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
SCREEN 13 PSET 160,100,255 Maybe, maybe not. What on earth does it do? I believe this attempts to set screen-mode 13 (I'm surprised this isn't a hex constant, though that may be a (Q)Basic quirk), which for older VGA cards was 320x200 with 256-colors. It then looks like it sets a point at (160,100 = the middle of the screen) in color #255. Ah, back in the days where each application had to maintain the screen itself, and you had to use hacks to get square pixels (the 320x200 in this mode had a non-square aspect-ratio) in Mode-X. Can't say I miss it much beyond nostalgia. -tkc -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
In article , Tim Rowe wrote: > >Really? I thought it was because of the lack of support for packaging, >which was solved in different ways by Object Pascal/Delphi and by >Modula 2, the latter of which in turn became Ada, which is still doing >pretty well in mission-critical contexts. I had never previously heard that Modula-2 significantly influenced Ada, and the Wikipedia entry says nothing about it. Do you have a cite? -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." --Red Adair -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
2009/4/18 norseman : > "...only within the current procedure." That was one of the "why Pascal > didn't hang on" as long as it might have. Really? I thought it was because of the lack of support for packaging, which was solved in different ways by Object Pascal/Delphi and by Modula 2, the latter of which in turn became Ada, which is still doing pretty well in mission-critical contexts. > Another was it's COBAL structure > in defining things. Just like today - the more typing the more errors, the > longer to 'in service'. Got any evidence for that? There's a lot of typing in Ada (it shows its Pascal roots) but in all the studies I've seen Ada production code has consistently shown fewer errors than the more concise C/C++ family of languages. -- Tim Rowe -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
On 18 Apr 2009 16:29:30 GMT Steven D'Aprano wrote: > On Sat, 18 Apr 2009 13:39:23 +0200, BJörn Lindqvist wrote: > > SCREEN 13 > > PSET 160,100,255 > > Maybe, maybe not. What on earth does it do? It makes people scratch their heads and wonder what the hell it does. -- D'Arcy J.M. Cain | Democracy is three wolves http://www.druid.net/darcy/| and a sheep voting on +1 416 425 1212 (DoD#0082)(eNTP) | what's for dinner. -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
On Sat, 18 Apr 2009 13:39:23 +0200, BJörn Lindqvist wrote: > I first started programming basic and i don't think it has hurt me much. > > I can somewhat sympathise with the op, neither python nor any other > mainstream language can still do this: > > SCREEN 13 > PSET 160,100,255 Maybe, maybe not. What on earth does it do? -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
Steven D'Aprano wrote: On Fri, 17 Apr 2009 14:00:18 -0700, Mensanator wrote: On Apr 17, 3:37 pm, baykus wrote: Hi I am looking for one of those experimental languages that might be combination of python+basic. Now thta sounds weird and awkward I know. That's a clue you won't find anyone seriously contemplating such idiocy. The reason I am asking is that I always liked how I could reference- call certain line number back in the days. A bad idea. If you really want to write bad code, learn C. It would be interesting to get similar functionality in Python. Yeah, it would "interesting" just as a train wreck is "interesting", as long as you're not the one who has to live through it. Nevertheless, somebody *has* implemented such functionality in Python. Not just GOTO, but also COMEFROM. http://entrian.com/goto/ I once translated a BASIC program to Pascal (hint: no goto allowed). Pascal has GOTOs. People rarely used them, because even in the 1970s and 80s they knew that unstructured gotos to arbitrary places was a terrible idea. GOTO in Pascal required that you defined a label in your code, then you could jump to that label. You can't jump to arbitrary parts of the program, only within the current procedure. What I found strange was that labels could be only unsigned integers, but they still had to be declared: label 1, 2, 3; Fortunately the version(s) I used (TurboPascal/Dephi) permitted identifiers. -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
BJörn Lindqvist wrote: I first started programming basic and i don't think it has hurt me much. I can somewhat sympathise with the op, neither python nor any other mainstream language can still do this: SCREEN 13 PSET 160,100,255 Maybe, who is able to understand such nosense without a lot of apriori knowledge ? cheers, Stef -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
Steven D'Aprano wrote: To paraphrase Charles Fiterman, the human should always win, because the human can use the machine, but the machine can't use the human. Unless the machine is Omnius. -- Greg -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
I first started programming basic and i don't think it has hurt me much. I can somewhat sympathise with the op, neither python nor any other mainstream language can still do this: SCREEN 13 PSET 160,100,255 2009/4/17, Leguia, Tony : > Though I don't know why you would want to reference lines numbers, I assume > it's for goto statements or something similar. > With that said please read: > 1) > http://www.u.arizona.edu/~rubinson/copyright_violations/Go_To_Considered_Harmful.html > > I would also like to put forth my opinion, shared by many in the community, > that Basic is actually dangerous as an educational programming language, and > that writing > large professional code in it is hard, and actually hampered by the > language. I'm not trying to to start a flame war here but this post almost > made me cry. > > Also python is functional, it's so powerful. Grow and learn to take > advantage of that. Why hold yourself back? > > > From: python-list-bounces+leguiato=grinnell@python.org > [python-list-bounces+leguiato=grinnell@python.org] On Behalf Of baykus > [baykusde...@gmail.com] > Sent: Friday, April 17, 2009 3:37 PM > To: python-list@python.org > Subject: Is there a programming language that is combination of Python and >Basic? > > Hi > > I am looking for one of those experimental languages that might be > combination of python+basic. Now thta sounds weird and awkward I know. > The reason I am asking is that I always liked how I could reference- > call certain line number back in the days. It would be interesting to > get similar functionality in Python. > -- > http://mail.python.org/mailman/listinfo/python-list > -- > http://mail.python.org/mailman/listinfo/python-list > -- mvh Björn -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
On Fri, 17 Apr 2009 20:45:30 -0700, Mensanator wrote: >> Nevertheless, somebody *has* implemented such functionality in Python. >> Not just GOTO, but also COMEFROM. > > Really? Well, _I_ for one, won't be beating a path to his door. Well you should. It's very clever code, and the way he solved the "problem" is intriguing. It was also a great April Fools joke. For reference, here's that URL again: http://entrian.com/goto/ >> GOTO in Pascal required that you defined a label in your code, then you >> could jump to that label. You can't jump to arbitrary parts of the >> program, only within the current procedure. > > And I deliberately made no effort to learn how to use them. And I never > had a situation I couldn't solve the "proper" way. You need to distinguish between the use of unstructured jumps like Basic- style GOTOs and COMEFROMs, which can jump anywhere, and the use of structured GOTOs and jumps that have well-defined meanings. GOTO, after all, is just a jump, and we use jumps in Python all the time: raise Exception break continue if... elif... else... for... else... etc. Often -- well, sometimes -- you can write cleaner, simpler code with GOTO than without. Fortunately, 95% of those cases can be dealt with a break or continue in a loop. In a high level language, GOTO is never necessary and rarely useful, but it is useful on occasion. Any time you find yourself creating a flag variable just so you can skip a code block, or enter a code block, then a structured GOTO *could* be a clean replacement. But probably isn't. (This is not a call for Python to develop a GOTO, just a defence that they aren't always the Wrong Thing.) COMEFROM on the other hand is just the purest evil imaginable. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
On Fri, 17 Apr 2009 22:26:32 -0700, norseman wrote: > The > average programmer, who takes a moment to think it out, "A moment"? As in, a second or less? > can out optimize > all but the best commercial compilers. The meticulous individual can > usually match or best the best commercials with fewer 'iterations' of > review when using assembly. That might have been true in the 1970s and 80s, but it hasn't been true for 10-20 years now. The best machine-optimized code is significantly better than the best human beings can do today, and even free optimizing compilers can do better than most people. However, human programmers can, sometimes, hand-optimize the output of the optimizing compiler in order to gain a slight upper-hand. To paraphrase Charles Fiterman, the human should always win, because the human can use the machine, but the machine can't use the human. http://www.linux.com/base/ldp/howto/Assembly-HOWTO/howtonot.html > Since one is already looking at the > registers and addresses, self optimization is simple. If only modern day programming was that simple. The interaction with modern CPU makes optimization an order of magnitude harder than it was back in the days of hand-tuned assembly. I quote from the above link: "The biggest problems on modern architectures with fast processors are due to delays from memory access, cache-misses, TLB-misses, and page- faults; register optimization becomes useless, and you'll more profitably re-think data structures and threading to achieve better locality in memory access." Toto-I-don't-think-we're-in-1975-anymore-ly y'rs, -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
Steven D'Aprano wrote: On Fri, 17 Apr 2009 14:00:18 -0700, Mensanator wrote: ...(snip) Pascal has GOTOs. People rarely used them, because even in the 1970s and 80s they knew that unstructured gotos to arbitrary places was a terrible idea. Even in primarily assembly only days that was true. GOTO in Pascal required that you defined a label in your code, then you could jump to that label. You can't jump to arbitrary parts of the program, only within the current procedure. === "...only within the current procedure." That was one of the "why Pascal didn't hang on" as long as it might have. Another was it's COBAL structure in defining things. Just like today - the more typing the more errors, the longer to 'in service'. Imitating Pascal's short jump only was Intel's lack of actual popularity among the Pro's of the day. Zilog had the better cpu, but Intel teamed with Gates, shoved interrupt only on everyone and the rest is history. In fairness to Pascal, the enforcement of no "goto" helped force the mass of new programmers (desperately needed now that 'desktops' were here) to think about their strategy. So did Ashton Tate's dBASE, which probably had more lines of code world wide in the first two years of its existence than any other (baring assembly) programming language in equal time. And no internet to help it. Every one who speaks bad of assembly has never had the satisfaction of truly feeling the power. ("'cause they got no proper background" - says the old man) The power of assembly is simple - if the machine can do it, it's allowed. No need to worry about "if the compiler will allow" or "work around that compiler bug" or "Oops - they changed the ...(compiler or interpreter) and now we start over". The average programmer, who takes a moment to think it out, can out optimize all but the best commercial compilers. The meticulous individual can usually match or best the best commercials with fewer 'iterations' of review when using assembly. Since one is already looking at the registers and addresses, self optimization is simple. I still have my Z80 pre-assembler. It allows Do, While, For and Loop along with If..Then..Else (and/or Elseif) statements in assembly programming. Z80 had both mandatory and full conditional call, jump, return ... anywhere to/from in memory. Intel's conditional jump forward was limited to 126 BYTES. Even with megabytes of memory. Worse than Pascal. "full conditional" - On Zero, plus, minus, overflow, underflow and some I don't remember. Most were 1byte commands. (Destination had to be added, but not return - the microcode took care of that.) Oh - and TRUE = 0, FALSE != 0 (Zero is good - no error) VisualBasic IS Microsoft's blend of Python and Basic. IMHO a bad blend. I am currently in the process of "converting" (re-writing is a better term) the key VB programs to Python/Tkinter for the department. The primary vendor finally got smart and told us VB wasn't going to be in their next release. Python is in, VB is out. Everybody jump up and shout HURRAH!:) Steve -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
On Apr 17, 9:43 pm, Steven D'Aprano wrote: > On Fri, 17 Apr 2009 14:00:18 -0700, Mensanator wrote: > > On Apr 17, 3:37 pm, baykus wrote: > >> Hi > > >> I am looking for one of those experimental languages that might be > >> combination of python+basic. Now thta sounds weird and awkward I know. > > > That's a clue you won't find anyone seriously contemplating such idiocy. > > >> The reason I am asking is that I always liked how I could reference- > >> call certain line number back in the days. > > > A bad idea. If you really want to write bad code, learn C. > > >> It would be interesting to get similar functionality in Python. > > > Yeah, it would "interesting" just as a train wreck is "interesting", as > > long as you're not the one who has to live through it. > > Nevertheless, somebody *has* implemented such functionality in Python. > Not just GOTO, but also COMEFROM. Really? Well, _I_ for one, won't be beating a path to his door. > > http://entrian.com/goto/ > > > I once translated a BASIC program to Pascal (hint: no goto allowed). > > Pascal has GOTOs. I know. _I'm_ the one who didn't allow them. And the code ended up pretty damn bulletproof. > People rarely used them, because even in the 1970s and > 80s they knew that unstructured gotos to arbitrary places was a terrible > idea. That was obvious from the BASIC code, enough to make you shake your head in disbelief. > > GOTO in Pascal required that you defined a label in your code, then you > could jump to that label. You can't jump to arbitrary parts of the > program, only within the current procedure. And I deliberately made no effort to learn how to use them. And I never had a situation I couldn't solve the "proper" way. > > -- > Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
On Fri, 17 Apr 2009 14:00:18 -0700, Mensanator wrote: > On Apr 17, 3:37 pm, baykus wrote: >> Hi >> >> I am looking for one of those experimental languages that might be >> combination of python+basic. Now thta sounds weird and awkward I know. > > That's a clue you won't find anyone seriously contemplating such idiocy. > >> The reason I am asking is that I always liked how I could reference- >> call certain line number back in the days. > > A bad idea. If you really want to write bad code, learn C. > >> It would be interesting to get similar functionality in Python. > > Yeah, it would "interesting" just as a train wreck is "interesting", as > long as you're not the one who has to live through it. Nevertheless, somebody *has* implemented such functionality in Python. Not just GOTO, but also COMEFROM. http://entrian.com/goto/ > I once translated a BASIC program to Pascal (hint: no goto allowed). Pascal has GOTOs. People rarely used them, because even in the 1970s and 80s they knew that unstructured gotos to arbitrary places was a terrible idea. GOTO in Pascal required that you defined a label in your code, then you could jump to that label. You can't jump to arbitrary parts of the program, only within the current procedure. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
baykus wrote: Hi I am looking for one of those experimental languages that might be combination of python+basic. Now thta sounds weird and awkward I know. The reason I am asking is that I always liked how I could reference- call certain line number back in the days. It would be interesting to get similar functionality in Python. -- http://mail.python.org/mailman/listinfo/python-list === Yeah - after they took at look at Python: Microsoft calls it VisualBasic There are some that will enjoy the joke. :) Steve -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
Michael Torrie wrote: Aahz wrote: Why do you want to do that? Before you answer, make sure to read this: http://www.u.arizona.edu/~rubinson/copyright_violations/Go_To_Considered_Harmful.html Somebody better tell the Linux kernel developers about that! They apparently haven't read that yet. Better tell CPU makers too. In assembly it's all gotos. Well CPU's wouldn't work as well if they didn't had a way to jump to a predefined instruction when certain conditions are met. IMHO for people who are users, that is you are not writing machine code or assembly, you should only use these 'goto's if you are capable of writing machine code or assembly. YMMV -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
2009/4/17 Michael Torrie : > Spaghetti code can be written in *any* language. I challenge you to write spahgetti code in SPARK! -- Tim Rowe -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
On Apr 17, 5:02 pm, Michael Torrie wrote: > Mensanator wrote: > > I once translated a BASIC program to Pascal (hint: no goto allowed). > > The original code had GOSUBs that never executed a REURN because > > the programmer jumped away to line numbers on a whim. Biggest piece > > of crap I ever had to misfortune to deal with. > > It's clear that you haven't done anything in BASIC since the 80s. Not hardly, I use VBA every day in Excel & Access. The example I mentioned WAS from the 80's. > And > probably the original poster hasn't either. So let's just clear the air > here. I don't see any need. Of course, you're the one who's view is muddied. > > I haven't seen a "GOTO" in BASIC code in probably almost 20 years, ever > since BASIC gained true structure. Try UBASIC. And I didn't say modern BASICs were like those of the 80's, I questioned why anyone would want to return to such systems as existed in the 80's. > In fact as BASIC is used today, it's > really similar to Pascal, but a lot nicer to work with. And I wasn't refering to that, I was specifically criticizing the jumping to random line numbers within the program. Can't do that in a modern BASIC? Fine, but who's asking for that? The OP. > BASIC is a very > structure language, and in VB, it's also object-oriented, although I'm > sure lots of crap is written in VB. You may shudder at the thought, but > BASIC is very much a modern language now. As I said, I use it (VBA) every day and have probably written more BASIC programs than you've had hot dinners. > If you're bored, check out freebasic.net. Thanks, but I'll give it a miss. > Not that I recommend you use FreeBASIC for anything (nor > do I recommend most languages but python!). > > Spaghetti code can be written in *any* language. It's nothing inherent > to BASIC. I have seen spaghetti python, particularly projects that are > designed around the twisted framework. Tracing execution through > twisted is very painful. Of course, but why would the OP think that someone's trying to make a language that makes spaghetti code easier? > > That said, what the original poster is looking for is very silly. That was my point. -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
Michael Torrie wrote: baykus wrote: I am looking for one of those experimental languages that might be combination of python+basic. Now thta sounds weird and awkward I know. The reason I am asking is that I always liked how I could reference- call certain line number back in the days. It would be interesting to get similar functionality in Python. *No one* in the BASIC world uses line numbers anymore. Why would you want to? ... The problem I see is that Basic as you use it above is not a language, but a family of languages. Different Basics share as much (and as little) as different SQLs. For my money, Visual Basic 5.0 is a language. THe different Microsoft Basics usually have a lot of language change, rather than being library additions. A lot of very different languages have been called Basic, with the attendant confusion as old syntax or semantics are abandoned or changed. The changes to Python 3.x is a language change, but Python has been _very_ conservative about changing (as opposed to extending) the language. There are only a few languages that might plausibly called "Basic", and Dartmouth Basic has maybe the best claim to that name. --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list
RE: Is there a programming language that is combination of Python and Basic?
>Somebody better tell the Linux kernel developers about that! They >apparently haven't read that yet. Better tell CPU makers too. In >assembly it's all gotos. There a very big difference between high level programming, and assembly programming. Python is a high level language. I shouldn't have to say anymore. From: python-list-bounces+leguiato=grinnell@python.org [python-list-bounces+leguiato=grinnell@python.org] On Behalf Of Michael Torrie [torr...@gmail.com] Sent: Friday, April 17, 2009 5:07 PM Cc: python-list@python.org Subject: Re: Is there a programming language that is combination of Python and Basic? Aahz wrote: > Why do you want to do that? Before you answer, make sure to read this: > http://www.u.arizona.edu/~rubinson/copyright_violations/Go_To_Considered_Harmful.html Somebody better tell the Linux kernel developers about that! They apparently haven't read that yet. Better tell CPU makers too. In assembly it's all gotos. -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
On Apr 17, 5:02 pm, Michael Torrie wrote: > Mensanator wrote: > > It's clear that you haven't done anything in BASIC since the 80s. And > probably the original poster hasn't either. So let's just clear the air > here. Michael you are kind of rigtht, I did use basic in early 90s :) Thanks for the more insightful comments, I understand the drawbacks and backwardness of Basic, I am not here to defend it. I guess I have a different perception when it comes to Basic. I think many people think those "lines" as numbered steps or numbered bricks that are sitting on eachother but I see them as timelines or like filmstrips. Anyways it sounds like such a toy programming language does not exists except Arnaud surprisingly efficient code. and I will search my dream somewhere else :) thanks for all the negative and positive comments :) -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
On Apr 17, 2009, at 16:37 , baykus wrote: Hi I am looking for one of those experimental languages that might be combination of python+basic. Now thta sounds weird and awkward I know. The reason I am asking is that I always liked how I could reference- call certain line number back in the days. It would be interesting to get similar functionality in Python. If all you want is the goto, or equivalent, in python then you can always use: http://entrian.com/goto/ Notice that this is, as everyone else says, a bad idea. It was made as a joke, but it is actually functional. bb -- Brian Blais bbl...@bryant.edu http://web.bryant.edu/~bblais -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
Aahz wrote: > Why do you want to do that? Before you answer, make sure to read this: > http://www.u.arizona.edu/~rubinson/copyright_violations/Go_To_Considered_Harmful.html Somebody better tell the Linux kernel developers about that! They apparently haven't read that yet. Better tell CPU makers too. In assembly it's all gotos. -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
Mensanator wrote: > I once translated a BASIC program to Pascal (hint: no goto allowed). > The original code had GOSUBs that never executed a REURN because > the programmer jumped away to line numbers on a whim. Biggest piece > of crap I ever had to misfortune to deal with. It's clear that you haven't done anything in BASIC since the 80s. And probably the original poster hasn't either. So let's just clear the air here. I haven't seen a "GOTO" in BASIC code in probably almost 20 years, ever since BASIC gained true structure. In fact as BASIC is used today, it's really similar to Pascal, but a lot nicer to work with. BASIC is a very structure language, and in VB, it's also object-oriented, although I'm sure lots of crap is written in VB. You may shudder at the thought, but BASIC is very much a modern language now. If you're bored, check out freebasic.net. Not that I recommend you use FreeBASIC for anything (nor do I recommend most languages but python!). Spaghetti code can be written in *any* language. It's nothing inherent to BASIC. I have seen spaghetti python, particularly projects that are designed around the twisted framework. Tracing execution through twisted is very painful. That said, what the original poster is looking for is very silly. -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
baykus wrote: > I am looking for one of those experimental languages that might be > combination of python+basic. Now thta sounds weird and awkward I know. > The reason I am asking is that I always liked how I could reference- > call certain line number back in the days. It would be interesting to > get similar functionality in Python. *No one* in the BASIC world uses line numbers anymore. Why would you want to? If you just want basic, get freebasic from freebasic.net Personally I can't see any reason to use any dialect of BASIC over Python. If you pine for the bad old days of jumping to random line numbers, maybe just create a list of function objects in python (a call table) and call a random one. -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
baykus writes: > Hi > > I am looking for one of those experimental languages that might be > combination of python+basic. Now thta sounds weird and awkward I know. > The reason I am asking is that I always liked how I could reference- > call certain line number back in the days. It would be interesting to > get similar functionality in Python. I am currently working on such a "Python-Basic" programming language. Here is the current implementation: -- basic.py class GotoLine(Exception): pass def goto(newlno): raise GotoLine(newlno) def run(program): lno = 0 env = { 'goto': goto } try: while lno <= max(program): try: if lno in program: exec program[lno] in env lno += 1 except GotoLine, g: lno, = g.args except Exception: print "? Syntax error in line", lno print "OK." Example of use == marigold:junk arno$ python -i basic.py >>> program = { ... 5: "# REM Python-Basic example program", ... 6: "# REM ", ... 10: "i = 0", ... 20: "print 'Hello, world', i", ... 30: "i = i + 1", ... 40: "if i < 10: goto(20)", ... 50: "name = raw_input('What is your name? ')", ... 60: "print 'Welcome,', name", ... 70: "gosub(80)" ... } >>> run(program) Hello, world 0 Hello, world 1 Hello, world 2 Hello, world 3 Hello, world 4 Hello, world 5 Hello, world 6 Hello, world 7 Hello, world 8 Hello, world 9 What is your name? Arnaud Welcome, Arnaud ? Syntax error in line 70 OK. >>> As you can see, I haven't implemented gosub() yet. -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
I guess I did not articulate myself well enough. I was just looking for a toy to play around. I never suggested that Python+Basic would be better than Python and everyone should use it. Python is Python and Basic is Basic. I am not comparing them at all. I understand the merits of Python but that does not mean I can play with ideas? -- http://mail.python.org/mailman/listinfo/python-list
RE: Is there a programming language that is combination of Python and Basic?
Though I don't know why you would want to reference lines numbers, I assume it's for goto statements or something similar. With that said please read: 1) http://www.u.arizona.edu/~rubinson/copyright_violations/Go_To_Considered_Harmful.html I would also like to put forth my opinion, shared by many in the community, that Basic is actually dangerous as an educational programming language, and that writing large professional code in it is hard, and actually hampered by the language. I'm not trying to to start a flame war here but this post almost made me cry. Also python is functional, it's so powerful. Grow and learn to take advantage of that. Why hold yourself back? From: python-list-bounces+leguiato=grinnell@python.org [python-list-bounces+leguiato=grinnell@python.org] On Behalf Of baykus [baykusde...@gmail.com] Sent: Friday, April 17, 2009 3:37 PM To: python-list@python.org Subject: Is there a programming language that is combination of Python and Basic? Hi I am looking for one of those experimental languages that might be combination of python+basic. Now thta sounds weird and awkward I know. The reason I am asking is that I always liked how I could reference- call certain line number back in the days. It would be interesting to get similar functionality in Python. -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
On Apr 17, 3:37 pm, baykus wrote: > Hi > > I am looking for one of those experimental languages that might be > combination of python+basic. Now thta sounds weird and awkward I know. That's a clue you won't find anyone seriously contemplating such idiocy. > The reason I am asking is that I always liked how I could reference- > call certain line number back in the days. A bad idea. If you really want to write bad code, learn C. > It would be interesting to get similar functionality in Python. Yeah, it would "interesting" just as a train wreck is "interesting", as long as you're not the one who has to live through it. I once translated a BASIC program to Pascal (hint: no goto allowed). The original code had GOSUBs that never executed a REURN because the programmer jumped away to line numbers on a whim. Biggest piece of crap I ever had to misfortune to deal with. No one has ever missed what you're pining for. -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a programming language that is combination of Python and Basic?
In article , baykus wrote: > >I am looking for one of those experimental languages that might be >combination of python+basic. Now thta sounds weird and awkward I know. >The reason I am asking is that I always liked how I could reference- >call certain line number back in the days. It would be interesting to >get similar functionality in Python. Why do you want to do that? Before you answer, make sure to read this: http://www.u.arizona.edu/~rubinson/copyright_violations/Go_To_Considered_Harmful.html -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." --Red Adair -- http://mail.python.org/mailman/listinfo/python-list
Is there a programming language that is combination of Python and Basic?
Hi I am looking for one of those experimental languages that might be combination of python+basic. Now thta sounds weird and awkward I know. The reason I am asking is that I always liked how I could reference- call certain line number back in the days. It would be interesting to get similar functionality in Python. -- http://mail.python.org/mailman/listinfo/python-list