Coding horrors? Absolute and goto! Who uses it? Who refuses it? Why?
Coding horrors? Absolute and goto! Who uses it? Who refuses it? Why?
Personally, I love absolute and goto, I use them with a lot of restraint of course, but they can be really useful tools at times. And in case of absolute, of course I make sure I do typechecking.
Personally, I love absolute and goto, I use them with a lot of restraint of course, but they can be really useful tools at times. And in case of absolute, of course I make sure I do typechecking.
I use them too, but only in extreme cases, where not using them would reduce readability. I have seen too many cases of abuse to use them lightly.
ReplyDelete(And I don't give a sh*t whether they are considered harmful or not.)
Of course similar restraint is required with Exit, Break and Continue.
I use them whenever I feel like it's the best option, I don't care what "gurus" say, there are many cases for "goto", sure you can go around, but why not use them?
ReplyDeletewith respect to absolute, I find very rarely use cases, but using them.
I use absolute from time to time. It's no worse than any other unsafe cast. Goto - not if I can help it.
ReplyDeleteI have always avoided goto. I rarely use absolute now, though I did when I was often interfacing to 3rd party DLLs. C coders seem to love their unions.
ReplyDeleteI haven't used goto since translating some old YACC C code to Pascal two or three decades ago. A totally useless command - unless you are writing complicated parsers. I do use absolute from time to time.
ReplyDeleteAbsolute is useful, goto is an anachronism. The worst keyword in delphi is with.
ReplyDeletewith is dangerous, indeed.
ReplyDeleteStill - I sometimes use that as well.
@Vitali I completely agree. Anyone working for me that uses "with" in their code gets to take a trip to the woodshed to pick the stick I will beat them with. goto is only useful for state machines - usually inadvertent ones. :-)
ReplyDeletewith could use an upgrade to it's syntax:
ReplyDeletewith somelist[index].item.reference as a, someotherparam as b
do begin
a.value := b.value;
if b.state
then a.dosomething;
end;
Any with clause which contains a comma is a code stink. It brings to mind all the reasons not to pursue multiple inheritance. I stopped writing with clauses a long time ago. I have inherited some, and whenever maintenance takes me in their direction, I remove them, as a high-value refactoring.
ReplyDeleteLars Fosdal I dream for such with as well, mate http://delphi.uservoice.com/forums/4432-general/suggestions/3428890-introduce-new-with-syntax
ReplyDelete