Forum > General

Question ?!!!!

(1/17) > >>

nouzi:
You could have this in free pascal ?
http://blog.marcocantu.com/blog/2018-october-inline-variables-delphi.html?fbclid=IwAR208x_u_TDY1iRILrxn3eZ-IbSFZPq_P_pLmRSY_V5WO-z6A6d1nbbLMB8

howardpc:
FPC introduced initialisation of variables in their declaration long before Delphi.
One drawback of syntax sugars that, for example, make the compiler infer and allocate implicit types to variables, is that they inevitably slow the compiler slightly, and make it that bit more complex and more time-consuming/harder to maintain.

Not to mention that they move Pascal further away from its Wirthian type-safe declarative design.

Thaddy:

--- Quote from: howardpc on November 11, 2018, 02:38:38 pm ---FPC introduced initialisation of variables in their declaration long before Delphi.
One drawback of syntax sugars that, for example, make the compiler infer and allocate implicit types to variables, is that they inevitably slow the compiler slightly, and make it that bit more complex and more time-consuming/harder to maintain.

Not to mention that they move Pascal further away from its Wirthian type-safe declarative design.

--- End quote ---
You're partially barking up the wrong tree, Howard. (Sorry, just let the dogs out  8-), actual dogs, two of them )
What he is referring to is:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---program testinlinevars;begin  // imagine lots of previous code  for var i:integer := 1 to 10 do writeln(i);end.
Or even with type inference:
--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---program testinlinevars;begin  for var i  := 1 to 10 do writeln(i);end.
Such code has been requested many times and always refused by the compiler team. In my opinion for all the right reasons.
Yes. The declarative design of Pascal is a feature and a huge asset. Working with C code bases for the last 30 years this kind of syntax should never be introduced and is often forbidden in huge C codebase examples like the Linux kernel.

Handoko:
The reasons for the rejection can be found here: (item #11)
http://wiki.freepascal.org/Modernised_Pascal

Thaddy:

--- Quote from: Handoko on November 11, 2018, 03:09:27 pm ---The reasons for the rejection can be found here: (item #11)
http://wiki.freepascal.org/Modernised_Pascal

--- End quote ---
That's only one of the reasons. There are many more to be found on the dev mailing list. Or even the original papers on the design of the Pascal language by Niklaus Wirth.

Navigation

[0] Message Index

[#] Next page

Go to full version