So far I know that arraytypes in Pascal is declared with an array length, but is there functions which might cannot be implemented because of that? and maybe still be written in C# for example?
Hi marcov,
I mean the static array
So as you text I can declare an array type as: type somearray = array [2..10] of integer
So I'm looking for an example of a function which cannot be written in pascal because of this type declaration, but on the other hand is possible to write in C# instead.
Hi
Ok then:
var a: array[2..10] of byte; Idx: integer; begin for Idx:= 2 to 10 do begin a[Idx]:= Idx; writeln('Array of index: ',a[Idx]); end; end;
Sometimes life is easy ;D
Regards Benny
So I'm looking for an example of a function which cannot be written in pascal because of this type declaration, but on the other hand is possible to write in C# instead.
So far I know that arraytypes in Pascal is declared with an array length...'
So far I know that arraytypes in Pascal is declared with an array length, but is there functions which might cannot be implemented because of that? and maybe still be written in C# for example?
What is the question again? A limitation of static arrays in pascal, that does not exists in c#?
So far I know that arraytypes in Pascal is declared with an array length...'
Not always. Dynamic arrays are supported in Free Pascal.
What are you actually trying to find out?
The static type array declaration in pascal, as I understand make it not possible to implement certain functions and I'm looking for an simple example of a function like that, but it should instead be possible to implement in C# instead,.
The static type array declaration in pascal, as I understand make it not possible to implement certain functions and I'm looking for an simple example of a function like that, but it should instead be possible to implement in C# instead,.OK, understood. I'm certain that everything you can implement in c#, it can be done in pascal too. You may argue that the c# implementation is more elegant or perhaps easier, but don't forget that c# was developed by Anders Hejlsberg and his team with the knowledge accumulated developing object pascal. On the other hand, some may argue that c#'s more modern features are overrated.
@italyrobertQuoteThe static type array declaration in pascal, as I understand make it not possible to implement certain functions and I'm looking for an simple example of a function like that, but it should instead be possible to implement in C# instead,.OK, understood. I'm certain that everything you can implement in c#, it can be done in pascal too. You may argue that the c# implementation is more elegant or perhaps easier, but don't forget that c# was developed by Anders Hejlsberg and his team with the knowledge accumulated developing object pascal. On the other hand, some may argue that c#'s more modern features are overrated.
So what is the c# code that can't be implemented in pascal? I did work with c# in the past, but I cannot recall any magical feature of arrays.
PS: @MarkMLI was faster.
you had 6 opportunities to ask for assistance to your problem from this forum but you have missed do it in a proper way.I don't think he is looking for assistance. More likely he is a c# developer and got into one of those tiresome flame wars about which programming languages is better. Now he must prove to his friend that c#'s array implementation is better then pascal. I'm I right @Robert? :)
I recall something like Kernighan's passages on Why Pascal is not my favorite programming language.
Looks like the guy has been stuck somewhere for the last 40 years.
It looks like it was in 1981.
...However since his book was written in 1976..
2.1. The size of an array is part of its typeCuriously, some of his complaints were already irrelevant at the time of publication.
If one declares
var arr10 : array [1..10] of integer;
arr20 : array [1..20] of integer;
...
...
This botch is the biggest single problem with Pascal...
The size of an array is part of its type
I don't think he is looking for assistance. More likely he is a c# developer and got into one of those tiresome flame wars about which programming languages is better. Now he must prove to his friend that c#'s array implementation is better then pascal. I'm I right @Robert? :)I can smell that, too ;)
QuoteIt looks like it was in 1981.
...However since his book was written in 1976..
Here it is:Quote2.1. The size of an array is part of its typeCuriously, some of his complaints were already irrelevant at the time of publication.
If one declares
var arr10 : array [1..10] of integer;
arr20 : array [1..20] of integer;
...
...
This botch is the biggest single problem with Pascal...
That's my question. Seems like ther's some misunderstandings going around here
So with this being the biggest problem, is there any functions, LIKE ANY EXAMPLE, which can't be implemented in pascal because of this. but instead C#?
So far I know that arraytypes in Pascal is declared with an array length, but is there functions which might cannot be implemented because of that? and maybe still be written in C# for example?No, there are not any functions that cannot be written because of that.
So with this being the biggest problem, is there any functions, LIKE ANY EXAMPLE, which can't be implemented in pascal because of this. but instead C#?
There is no because of this, because modern Pascal is not restricted to this as everyone else already wrote. In the Pascal of the past (30, 40 years ago) there would be functions that can't be (easily) implemented, but since the era of Delphi (mid 90s) at the latest this is not the case anymore.
You cannot implement writeln(1.0:2:3) for your own types
In the Pascal of the past (30, 40 years ago) there would be functions that can't be (easily) implemented, but since the era of Delphi (mid 90s) at the latest this is not the case anymore.
In the Pascal of the past (30, 40 years ago) there would be functions that can't be (easily) implemented, but since the era of Delphi (mid 90s) at the latest this is not the case anymore.
This wasn't the case even way before Delphi: most Pascal compilers of the mid-80s (1982 the oldest I know about: Pascal MT+ v5) already allowed for this in one way or other.
The thing is that while valid for what he was talking about, Kerningham's critic was one of the last even remotely founded on fact, and even then most compiler producers had started to solve most of those shortcomings in one way or other.
Such things /can/ be a problem if using Pascal or its close relatives for systems programming (e.g. passing network packets around), but Kernighan wasn't claiming to do that so I feel his criticism was out of place.
So with this being the biggest problem, is there any functions, LIKE ANY EXAMPLE, which can't be implemented in pascal because of this. but instead C#?
There is no because of this, because modern Pascal is not restricted to this as everyone else already wrote. In the Pascal of the past (30, 40 years ago) there would be functions that can't be (easily) implemented, but since the era of Delphi (mid 90s) at the latest this is not the case anymore.
You cannot implement writeln(1.0:2:3) for your own types
That was not the question however. The question was related to array types and whether you can implement any C# function using such as result types in (modern) Pascal.
Did the planet have a lot of tainted water this month? I've seen more crazy posts this month than I've seen in a long time...
A beginner question on functions in FPC pascal : I want to use ArcSin, ArcCos and ArcTan2 of unit math ; is it possible to have access to the ArcTan2.pas source instead of ArcTan2.ppu, to carefully study the implementation of mathematical functions in my code ? because the recipe for, for instance x+iy complex is to use t := 2*ArcTan2( y, x+Sqrt( x*x+y*y ) on the range ]-Pi..Pi] for
the complex logarithm/exponential pseudo-functions. (I shal be glad to incorporate modifications of this function in my code for
mathematical accuracy). Friendly. Yves .
A beginner question on functions in FPC pascal : I want to use ArcSin, ArcCos and ArcTan2 of unit math ; is it possible to have access to the ArcTan2.pas source instead of ArcTan2.ppu, to carefully study the implementation of mathematical functions in my code ? because the recipe for, for instance x+iy complex is to use t := 2*ArcTan2( y, x+Sqrt( x*x+y*y ) on the range ]-Pi..Pi] for
the complex logarithm/exponential pseudo-functions. (I shal be glad to incorporate modifications of this function in my code for
mathematical accuracy). Friendly. Yves .
Did the planet have a lot of tainted water this month? I've seen more crazy posts this month than I've seen in a long time...
Pandemic psychosis.