[SLOF] [PATCH] Add a global "dir" method

Segher Boessenkool segher at kernel.crashing.org
Thu Jun 9 18:27:22 AEST 2016


On Thu, Jun 09, 2016 at 06:07:12PM +1000, Benjamin Herrenschmidt wrote:
> On Thu, 2016-06-09 at 02:18 -0500, Segher Boessenkool wrote:
> > On Thu, Jun 09, 2016 at 01:46:46PM +1000, Benjamin Herrenschmidt
> > wrote:
> > > 
> > > +: do-dir ( devstr len -- )
> > > +  cr ." Directory of: " 2dup type ."  ... "
> > That is debug code, right?  The user knows what he typed, and if not,
> > he can always look one line up ;-)
> 
> Well, it's de-aliased which is handy, that's why I left it there.

Ah yes.

> > > +: find-path ( dir-cluster name len -- cluster file-len is-dir?
> > > true | false )
> > Things will be simpler if you store to dir? directly here, instead of
> > passing it around.
> 
> Not necessarily and I don't like functions like that having side
> effects, it makes the code even more convoluted. This find-path
> has no side effect, only inputs and outputs.

Yes, ten gazillion inputs and outputs now ;-)

You already store that state slightly later, why not do it here already
and have simpler code, much easier to read?

> > > +  2>r
> > Useless comments are useless ;-)
> 
> It's not useless, it wasn't clear to me which side was left and which
> one was right :-)

left is left, right is right -- very handy semantics :-)

If a word is hard to follow try factoring it.  Stack comments inside
a word are almost always a bad idea.


Segher


More information about the SLOF mailing list