Volker:

> Have not seen it this way, yes, you are right. I apologize.
>  IIRC we discussed that script and if a pretty-printer could clean it.

No need to apologise for deeply-held convictions :-)

The important issue is that the "official style" as described here:
   http://www.rebol.com/docs/core23/rebolcore-5.html
isn't used by all of us.

So a pretty-printer that can convert between the major styles will be of use 
to us all.

Carl is on record as saying it isn't possible to do one. But I think he's 
looking from a purist computer science perspective.  From an engineering 
perspective, we could easily do something that handles 95% of all practical 
cases.

***

There are two big problems:

First words *may* be redefined:

  if a = 1 [
   print true
   ]
   [print false]

Is correctly indented according to the official style. Unless it were 
preceded by
   if: :either
when it should be

  if a = 1 [
    print true
    ][
    print false
    ]

And what if it is in a loop -- how best to stylise this code?

  loop 2 [
     if a = 1 [print true][print false]
     if: :either
    ]


The best engineering solution to problem 1 is to ignore it. Same as Carl's 
code coloring scripts do. Treat the source as seen when statically loaded.

***

Problem 2 is that the guidelines assume start and end block characters, but 
they are not always needed:

if 1 = 2
    load "do [print 'different]"

Or should 'load be treated as if were the open square bracket?

if 1 = 2  load
    "do [print 'different]"


Again, the best thing to do is ignore that.  Anyone with that problem would 
be welcome to extend the code to handle it.

***

I'd welcome a strong (as in powerful) prettyprinter that can convert between 
different styles.

The those of us who publish scripts can happily write them our way, and 
publish them to the official style.

Sunanda.
-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to