Documentation options

Igor Stasenko siguctua at gmail.com
Wed Jan 2 11:11:53 UTC 2008


On 02/01/2008, Hans-Martin Mosner <hmm at heeg.de> wrote:
> Igor Stasenko schrieb:
> > Some languages, like Pascal stopping parsing source when reaching some point.
> >
> > In Pascal it's the 'end.' sequence. You can put anything beyond that input.
> >
> > In smalltalk, we also could have such feature: no reason to parse text
> > beyond the last return statement, because it's not reachable.
> >
> > Interesting that current compiler barfs on code past the return
> > statement, saying that there's nothing expected after return.
> > I don't like such behavior: Sometimes i need to stub-out some code, to
> > test/debug methods, and i can't simply put ^self in the very beginning
> > of method (it forces me to put '[^self] value' instead, just to get
> > around such 'cleverness' of compiler ).
> > Very inconvenient and useless feature, as for me, and it can be simply
> > replaced by ignoring any input instead.
> >
> >
> >
> Sorry, I consider silently ignoring program text rather problematic.

What is the problem by ignoring things which is not going to work anyways?

> In my experience, putting something in comment quotes or inside "false
> ifTrue: []" is pretty easy and preserves the simplicity.

Commenting out the code is easy, if your method does not contain mix
of code/comments, so you can comment all the code in single block.
Otherwise you need to put "" in multiple places.. takes a lot of time
and it's stinks.. :)

> If you want to be extra careful that such things never creep into
> production code you could define a method BlockContext>>skipCode which
> does just nothing, and wrap code to be skipped in "[] skipCode" :-) Of
> course, you'd need to check for senders of this selector before
> building, just as you would have to check for senders of #halt...
>
There's a lot to consider in production code. You can put 'self flag:'
.. in places where you need return later. Why introducing another
method (skipCode)?

I don't see how restricting or not input past the last return
statement can make big difference.

Also, consider, that given change would help in documenting the
sources, and as side effect can help with quick hacks, which sometimes
needed when debugging the code.
I see more benefits that drawbacks.

> Cheers,
> Hans-Martin
>
>


-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list