Craigix, Free Units To Devs?


WizardStan said:
Gren said:
Well said.

I'm an IBM Z/OS High Level Assembler developer, and unconditional branches are used extensively, and with extreme prejudice in many programs.
Of course the comedy value is low in such modules, at least compared with the excellent BXLE back axle instruction and other fabulous bizarre examples.

Of course you need to be covered in marmite and dancing a jig before being allowed to use these "non-standard" instructions.....
For the record, you guys know I was joking when I said to never ever use goto, right? When I make what I think is an obvious joke which spawns serious discussion, I start to wonder if I wasn't obvious enough.

Yes, yes I did.

Hence the reference to marmite and jig dancing.

:rolleyes:
 
Last edited by a moderator:
dflemstr said:
Exophase said:
borgqueenx said:
give a free pandora to someone willing to make a DS emulator, a N64 emulator, a psp emulator:)

God doesn't need a Pandora, he can will one into existence.
What could God do with a Pandora anyways...
I haven't seen a LISP compiler/interpreter for it yet.
lisp.jpg

Also I'd be really surprised if none of the Common Lisp implementations could not run on the pandora - I really want to have http://maxima.sourceforge.net/ in my pocket.
 
Last edited by a moderator:
Alec  said:
Also I'd be really surprised if none of the Common Lisp implementations could not run on the pandora - I really want to have http://maxima.sourceforge.net/ in my pocket.
So, in other words, you would be surprised if Common Lisp implementations could run on the Pandora? Or am I parsing your double negatives wrongly... :p

But yeah, LISP will probably run on the Pandora without issues. I'm more of a Haskell guy myself, though (less awkward syntax, even though it's less... beautiful).

EDIT: And, yeah, God knows Perl too, but I haven't seen an interpreter artificially intelligent syntax parsing linguist for that on the Pandora, either.
 
Last edited by a moderator:
the only programming language I know is TI Basic
Code:
0→x
Lbl A
Disp x
x+1→x
Goto A
Can anyone guess what this program did?

Edit: This program is a really easy way to kill the batteries in school calculators
 
@ crosfyah

hmm several problems here!!

1st..you used BASIC
2nd..you used REALLY OLD BASIC WITH LINE NUMBERS
3rd..it wasn't an object
4th..it wasn't modular
5th..no pointers or indirection
6th..no comments
7th..no copyright
8th..you used hard values rather than defined variables
9th..you forgot to clear the screen
10th..you failed to put a space and semicolon at the end of the text and the line respectively
11th..you didn't check for string being valid
12th..you didn't check for illegal control codes


need I go on


EPIC FAIL

Craig....please send his Pandora to me, since I have THE POWER!

@ xxbenxx
it crashed after several hours/days when the display overflowed

0,1,2,3,4,5,6,7,8,9,10,11.......CRASH!
 
X x Ben x X said:
the only programming language I know is TI Basic
Code:
0->x
Lbl A
Disp x
x+1->x
Goto A
Can anyone guess what this program did?

Edit: This program is a really easy way to kill the batteries in school calculators
I actually opened my TI Voyage 200 to try this out, just for the heck of it! :p
 
Last edited by a moderator:
dflemstr said:
Alec  said:
Also I'd be really surprised if none of the Common Lisp implementations could not run on the pandora - I really want to have http://maxima.sourceforge.net/ in my pocket.
So, in other words, you would be surprised if Common Lisp implementations could run on the Pandora? Or am I parsing your double negatives wrongly... :p

But yeah, LISP will probably run on the Pandora without issues. I'm more of a Haskell guy myself, though (less awkward syntax, even though it's less... beautiful).

EDIT: And, yeah, God knows Perl too, but I haven't seen an interpreter artificially intelligent syntax parsing linguist for that on the Pandora, either.

Haha, yes, I really should have reread it before posting. I even got my url tag backwards... :huh:
 
Last edited by a moderator:
X x Ben x X said:
the only programming language I know is TI Basic
Code:
0→x
Lbl A
Disp x
x+1→x
Goto A
Can anyone guess what this program did?

Edit: This program is a really easy way to kill the batteries in school calculators

TI-BASIC was my first ever language, and although I've tried to put it behind me I still know what that does.

Unfortunately, there are much easier ways to break their calculators. Especially since a few years ago, one of the members from Detached Solutions leaked how you unlock flash (it's only a few bytes worth of code), despite TI asking/threatening them not to.

So, make a file...

Code:
AsmFile
// insert bytecode to unlock flash
// insert bytecode to delete critical file

and run Asm(PROGRAM). The overall bytecode is only a few DWORDS long, easy enough to type in in a few seconds. Doing this will completely 100% break the calculator, with no way to repair it short of sending it to TI.

Edit: By a few years ago, I mean ~year 2000. God, has it been that long already?

*feels old* :(
 
Last edited by a moderator:
krosfyah said:
Code:
10 PRINT"I am a dev"
20 GOTO 10
Can I have my free Pandora now?

No punctuation. And is the lack of space between PRINT and the quote a syntax error. Please proof-read your code and at least test it before publishing it to the community.

Perfectly good use of a goto. Any so called "programmers" that thinks differently are not as good as they think they are.


mali said:
While we are at it, another person who should definitely be on the list is Gruso. Without his persistent commitment, the project would already have been order-cancelled to oblivion.

+several million. At the very least he should be in the first batch shipped out.


WizardStan said:
krosfyah said:
Code:
10 PRINT"I am a dev"
20 GOTO 10
Can I have my free Pandora now?
You used goto. A real dev would know that you never, under any circumstance, ever use a goto, least of all the edge case where a goto actually makes sense. Simply not overengineered enough. No Pandora for you. Only velociraptors.
There's hope for you yet. So prey tell on a BBC micro how would you have got(ten) back to line 10 without one.

Exophase said:
borgqueenx said:
give a free pandora to someone willing to make a DS emulator, a N64 emulator, a psp emulator:)

God doesn't need a Pandora, he can will one into existence.
And God made the Earth in 6 days and on Sunday God rested and planned the Pandora, which then took him another 2 months[sup]tm[/sup].
 
Last edited by a moderator:
hobbyman II said:
@ crosfyah

hmm several problems here!!

2nd..you used REALLY OLD BASIC WITH LINE NUMBERS
3rd..it wasn't an object
4th..it wasn't modular
5th..no pointers or indirection
10th..you failed to put a space and semicolon at the end of the text and the line respectively

well working within the restrictions of the language (which you yourself have recognised in point 2), points 3,4 and 5 would be pretty hard if not impossible to accomplish and point 10 is totally invalid as a semicolon at the end of the line is a syntax error in all old BASIC implementations.
 
Last edited by a moderator:
There's hope for you yet. So prey tell on a BBC micro how would you have got(ten) back to line 10 without one.

for a guess....been a while now

5 cls: let limit=2
10 for I=0 to limit
20 print I;" ";
30 inc limit
40 next I

cos the older systems where quite happy to allow you to alter loop control variables on the fly since internally they where just another variable, I used this trick constantly before "break" became part of the BASIC syntax, just set the loop value to less than the finish value..ie.

10 for i=1 to 10000
20 print i;" ";
30 if inkey$=" "
40 exvalue=i
50 i=10001
60 endif
70 next i
80 print:print "loop exit at an I value of ";exvalue:print

the same trick works nicely for nested loops too, I also agree with may88 that GOTO is not actually an issue or a sign of bad code, improper use is, the whole "BASIC is bad cos you can use goto" mantra actually stemmed from ONE article some guy wrote about language syntax and programming in general, everybody then jumped on the bandwagon (since the "Pros" looked down on BASIC users impinging on their ELITE status, can`t have the hoi-poloi actualy making heir own software, can we?)

modern compiled dialects of BASIC have all the features and speed of languages like C/C++/C#, that is, they have been benchmarked to produce code of comparable speed, have built in assemblers, structures and are event driven, but they STILL get lumbered with the old saws of being slow, unwieldy and unsuited to writing large structured programs, but IMO its still the simplest language to learn and perfect for rapid prototyping, in fact I never bothered learning apps like spreadsheets/databases etc, imo it's simpler to just rattle out a BASIC app for whatever problem you want to solve, plus the program can be perfectly customised to your requirements.
 
edit, just realised, I got carried away over altering control variables, you can also do

5 let number=0
10 for i=1 to 2 step 0
20 print number;" ";
30 inc number
40 next i

:huh:
 
The bug was probably you hitting reply instead of edit
wink.gif


I agree that languages with "BASIC" in their name don't deserve to be automatically lambasted for it. On the other hand, it's hard to really say that they share an awful lot in common outside of the name and some superficial syntax decisions. None of the modern compiled BASICs are anywhere near as portable as C or C++, or even Java, and they don't have the wealth of library support either. These are major disadvantages that keep them from being used very seriously in the workplace. But when it comes to personal projects people should use whatever they feel most comfortable and justified in using.

On goto, since I guess that's been the main thrust of this thread for some reason... I always felt that Dijkstra's criticism of goto is a lot like Knuth's criticism of "premature optimization" (incidentally, Knuth actually refuted Dijkstra's goto criticism).. point is, they were addressed to people who didn't really catch on how to program well. This is already known to most of you, but for the few who might not know: languages used to be largely unstructured and you had to use goto manually for simple control flow structures. Most desired control flow can be expressed in these structured statements, so people were rightfully being told to stop baking their own w/goto all the time.

The other side of it is that some of these far reaching statements were coming from a background of computer theory and theory has this tendancy to breed extremist and over-generalized statements.
 
Last edited by a moderator:
Out of curiosity, what are these cases where the use of goto is warranted, okay or even required? I've been programming for a relatively short time, about 15 years, but I've yet to come across a situation where I'd actually get any real advantage using goto instead of a loop structure or something alike. My university's department of software engineering teaches the "never goto and don't optimize, just get a better algorithm" mantra because clarity is deemed the most important aspect of code right after actually doing what it's supposed to. I know this is going really offtopic, but I'd like to hear comments on this to grow as a programmer.
 
There's hope for you yet. So prey tell on a BBC micro how would you have got(ten) back to line 10 without one.

Code:
10 print "on an oric, you do this"
20 run

Total lack of goto!
 
B-ZaR said:
Out of curiosity, what are these cases where the use of goto is warranted, okay or even required? I've been programming for a relatively short time, about 15 years, but I've yet to come across a situation where I'd actually get any real advantage using goto instead of a loop structure or something alike. My university's department of software engineering teaches the "never goto and don't optimize, just get a better algorithm" mantra because clarity is deemed the most important aspect of code right after actually doing what it's supposed to. I know this is going really offtopic, but I'd like to hear comments on this to grow as a programmer.

One of the classic examples of using goto in C is to break out of several nested loops. This is much more concise and efficient than building bound conditions into every loop stage, yet you see people doing this just to avoid the goto. Another typical use case is breaking out to an error handler at the end of a function. This is much preferable to having several nested ifs. Again, we're talking pure C, which is still a major force in the market. goto is often effective as an optimization for quickly switching state. For instance, in an ARM interpreter I've used gotos to switch from an ARM execution loop to a Thumb execution loop on (uncommon) instructions which do so. This is far more efficient than checking the state at every iteration of the loop.

Computed gotos (GCC) can be used to implement crude/simple but effective coroutines and more efficient switch-like structures.

Your university's mantra is naive and, quite frankly, stupid. Which is not surprising, because many universities will hammer mantras like this out of a complete lack of confidence in is students to grow and eventually be capable of thinking for themselves. Which is not completely unwarranted because universities have to cater to the lowest common denominator, and especially at undergraduate level and especially at a middle of the road university a majority of the students are not going to be stellar. It's easier to teach dogma than it is to try to teach critical thinking.

That said, to an audience of experienced and, could we say, "good" programmers their advice is not useful, which is just as well because I don't think this was ever their intended audience. Choosing a better algorithm is itself an optimization, but it's insulting to the programmer's intelligence to assume that they're always using an obviously inferior algorithm. It's also overly-simplistic to think that most problems in the real programming world boil down to a matter of big O time (that's what we're talking about when we talk about "better" algorithms, right?) when the opposite is usually the case. You should choose the "best" algorithm first, which in itself will most likely contain compromise beyond some obvious decisions. Then it's suitable to target more agnostic optimizations, including but not limited to many of the things compilers will try to do (but often fail), examining said compiler output and massaging it for better results, caching and packing, improving impact on memory hierarchy, and even rolling out your own assembly.

A lot of emulators for GP2X/Wiz have achieved significant (50-100% or more) speed improvements only by utilizing well written assembly code. Unfortunately, a lot of theorists and academics won't even acknowledge such an improvement as worth consideration. So we're left with the end user's impression - is a 50% speed emulator as good as 100% speed one?
 
Last edited by a moderator:
as an aside, it always amused me that some commands like "break" and "exit"* used in structured languages are actually thinly disguised goto's, what they obviously do is "GOTO loop-ending" or "GOTO line-after-endif", the compiler just computes the offset at compile time, hiding something does not mean it`s not there, likewise, heavily hand optimised code (as in drivers where performance is critical) may have several abrupt loop exits hard coded in, even these fancy "structured language" compilers use goto internally, just take some optimised C/C++/C# code and load it into a decompiler/assembler, you see plenty of JMP instructions (or whatever they are in x86), the reason you have jump instructions built into the CPU instruction set is that often its the fastest way to do something, point being, goto is not bad, just the misuse of goto, in many cases an assembler coder will use goto purely to save the clock cycles consumed pushing return addresses and stack values into storage when they will be not be needed again or can be safely returned to later without saving, the added control of asm allows you to make these decisions.


*note: these commands only surfaced after goto became unfashionable, using the obligatory car analogy, it`s like everyone became a raging environmentalist and sold their cars, then they realised they still needed a car, so they bought another, but pre-fitted with a body-kit that made it look like a donkey. just to save face, now they all claim they don`t use cars, just donkeys, but you and I know its a car really. :blink:
 
Hate to play on the opposing side on this one but the usual "the assembler outputs goto anyway" response indicates a profound misunderstanding of the argument :/
 
Back
Top