[fpc-devel] Re: [fpc-l] type discussion

Jamie McCracken jamie-junk at blueyonder.co.uk
Sun Jun 5 13:01:33 CEST 2005


Michael Van Canneyt wrote:
> 
> On Sun, 5 Jun 2005, Jamie McCracken wrote:
> 
> 
>>Hans-Peter Diettrich wrote:
>>
>>
>>>>Not at all; I certainly don't indent them, and I'm a fanatical
>>>>indenter.
>>>
>>>
>>>Agreed. I really can't understand why some people indent like this:
>>>if ...
>>>then
>>>begin
>>> ...
>>> end
>>>else
>>>     if
>>>...
>>
>>lol - thats not what I meant. If you want readable code you indent inside the
>>begin..end blocks ergo the begin..end syntax becomes redundant cause its the
>>indentation that provides the visual cue.
> 
> 
> Visual, yes. But not for the compiler: it folds whitespace.
> The compiler NEEDS the begin...end to check your syntax. 
> How is it supposed to know where a stament block begins/ends ? 
> Based on indendation alone ? That would not be Pascal...

yes you are right it exists for the benefit of the compiler rather than 
the developer.

My plan in the RAD Pascal dialect is to preprocess each line and put 
back the begin/end where the indentation occurs/varies without altering 
the line numbers. The compiler already has an internal preprocessor so I 
will simply be extending that. If the end result is not to your liking 
then continue using other dialects as none of my changes will affect 
them. Of course there is nothing stopping you from continuing to use 
begin end blocks in RAD Pascal if you really want to but they will be 
optional whereas indenting will be compulsory (you will get an error if 
your indenting is not consistent!)

jamie.




More information about the fpc-devel mailing list