[fpc-devel] Re: [fpc-l] type discussion
daniel at deadlock.et.tudelft.nl
Thu Jun 2 23:12:02 CEST 2005
Op Thu, 2 Jun 2005, schreef Jamie McCracken:
> Daniël Mantione wrote:
> > Granting all those wishes would turn the language in an enourmous
> > monster. That doesn't look like a good idea. We've also a limit amount of
> > developers whos time needs to be spent well, or we'll get behind.
> > So, we're very convervative. Good ideas though, that will really benefit
> > people, will be read with great interrest.
> okay but my idea was to have a new dialect (i'll call it RAD-Pascal) as
> FPC supports multiple dialects it can slip in without affecting existing
> code so if people dont like it they dont have to use it. Im quite happy
> to write it myself but I will need help on where to look and what to
> modify in the compiler as im not familliar with the compiler source (I
> cant even find the grammar for the language so I take it you dont use a
> table driven or auto generated parser like yacc)
Ok! We'll be happy to assist anyone doing interresting developments with
Free Pascal. Keep in mind though that implementing ideas can take "a lot"
more time that thinking out ideas.
The Free Pascal parser is indeed manual craftmanship. Some experimenting
was done using yacc in the past but a handwritten parser turned out to be
the best choice. The parser units start with the letter p, for example
pexpr.pas is the expression parser.
As for forward declarations, forget it for the short term, adding a pass
is way too complicated for a beginner.
Lastly, a good language tries to maximize power while limiting language
constructions. Keep that in mind.
> > Users like software written in Pascal. They dislike software requiring
> > JDK's and .NET runtimes.
> > So, lets turn the disadvantage in an advantage. Pascal is no replacement
> > for Java and C#. It is a replacement for C and C++.
> It is a replacement for java and c# for *desktop* apps. I have rewritten
> several java apps into delphi in my previous jobs.
Yes... Because Java often turns out to be the wrong tool and its memory
management is one of the reasons. We need to be carefull to prevent Pascal
becoming a wrong tool. However, automated memory management does have some
advantages. Nobody can deny that.
> > Now, the majority of software is written in C and C++. Isn't that a great
> > potential "market"?
> >>All in all the changes would mean you spend more of your time
> >>implementing your application rather than typing loads of redundant
> >>code. Maintenance is easier as their is less redundancy.
> > As has already been said, typing is not the problem, maintenance is.
> > Pascal does a good job here, saving people a lot of time.
> except were the source is bloated by forward declarations :)
Just order your procedures like you should order them, go go!! :)
daniel at laptop:~/fpc2/fpc/compiler> grep ';forward;' *.pas
browlog.pas: procedure writesymtable(p:Tsymtable);forward;
pexpr.pas: function sub_expr(pred_level:Toperator_precedence;accept_equal : boolean):tnode;forward;
pstatmnt.pas: function statement : tnode;forward;
daniel at laptop:~/fpc2/fpc/compiler> grep '; forward;' *.pas
browcol.pas: function GetDefinitionStr(def: tdef): string; forward;
scanner.pas: function read_expr : string; forward;
daniel at laptop:~/fpc2/fpc/compiler>
Wow! 5 forward declarations in the entire compiler source. Yeah, bloat
> None of my proposed changes should be detrimental to pascal's
> maintainability or clarity as I too value that feature.
If you want to expiriment, go ahead and we'll be helpfull. That'll be more
productive than this discussion. However, your time is propably as
valuable as ours, try to make features that'll really help people.
More information about the fpc-devel