Forum > Options

IDE auto-complete try except/finally end structure

<< < (2/2)

Thaddy:
They are two completely different things.
The Try / Finally is about memory management for heap allocated objects. If you come from java you are spoiled. (and not very well educated if you think it is better)
The try / Except is about exceptions / error trapping. Just like Java.

Compared to java, which is in all but name a scripting language (I do NOT mean Java Script, properly named ECMA script) / ok, bit too strong, FreePascal renders real processor  level compiled code and needs to take care of memory allocation and de-allocation itself. That's where try/finally comes in.
Java does that for you by means of its garbage collector. In many ways similar strategies are possible in FPC, like ARC and the LLVM model (which is also ARC, at least ARC like).
That is not exactly the same however.
finally and except are different things, remember that.

FYI: I use Java a lot! I am not bashing it.

Anyway, my first Pascal compiler compiled to P-code as well: UCSD Pascal.
I also know C++ allows this somehow but not that I like that: mixing up paradigms.













Leledumbo:

--- Quote from: rc.1990 on August 30, 2016, 06:15:00 pm ---Just curious why try/except and try/finally that are two commands can't also be a unique command such as try/except/finally?

--- End quote ---
Legacy.

--- Quote from: rc.1990 on August 30, 2016, 06:15:00 pm ---Why a unique command try/except/finally is not possible?

--- End quote ---
It is possible, but the compiler developers aren't convinced enough why it should be implemented. Please read this wiki page along with the linked FAQ page to understand the criteria of a feature proposal that can be accepted (not necessarily implemented). From what I can see, the unified syntax only reduces typing, with the expense of misunderstanding the flow (When will finally block be executed? In case exception happens, will it be executed as well? Before or after the except block? Etc.). With separated syntax, you can clearly design the flow yourself with nesting. except inside or finally inside? You choose.

rc.1990:
Leledumbo and Thaddy, thanks for the explanation.

tol:
Sorry, this thread is already old, but I still have to correct something here.

@Thaddy

Accusing someone of not being well educated is an impudence in itself.
But then to claim Java is a scripting language is ridiculous.
Scripting languages usually have an interpreter and are not based on compilation!

If the compiler compiles to byte code it is in fact a compiled language. Period!
Just because Java doesn't (usually!) compile to native machine code doesn't make it a "scripting language"!
And because there are/were (old) interpreted implementations, the language is by no means a "script language". The same applies to other languages like C#, LUA etc.
In the end, “script language” is already a weak definition. You can script with many languages. As so often it depends on the specific use!

The opposite of compiling is by no means “scripting”.

Try to catch up with your own education starting here: https://en.wikipedia.org/wiki/Scripting_language

Unfortunately, you can always see that some of the remaining Pascal enthusiasts are "extremist" when it comes to "their" language.

PS: Saying that you use something and therefore don't discredit it.. is an imposition on the reader in itself. It just shows that this accusation has clearly been made many times!

cdbc:
A bit of "Necromancy" going on here?!?

Navigation

[0] Message Index

[*] Previous page

Go to full version