Weird Idiom: Labeling Values?

I'm going through and changing a lot of FUNCTION uses to FUNC + LET. The long term goal will be to eliminate the locals-gathering functionality...and you either use LET/USE or you go explicit with <local> in the function spec.

I came across this:

    size-as-binary: enbin [be + 8] length of embedding
    append executable size-as-binary

This was the only use of the variable. Changing it to a LET works, but it's kind of a waste:

    let size-as-binary: enbin [be + 8] length of embedding
    append executable size-as-binary

LET's assignment form does run the right hand side...because the LET word itself vaporizes, so it's like the bound new SET-WORD! just runs as normal:

    append executable let size-as-binary: enbin [be + 8] length of embedding

But a LET isn't really necessary here. I had a weird thought, what if a TAG! or ISSUE! or something was used in a way that was "obviously" throwing it away?

    append executable (<size-as-binary> enbin [be + 8] length of embedding)

Maybe a little confusing. But it saves on a variable declaration.

A comment is zero overhead, so I'm doing that...

    append executable enbin [be + 8] length of embedding  ; size of binary

But I just thought the idea of a deliberately discarded leading value was kind of interesting.

1 Like

I'm curious to know what others think about this.
I prefer not to chain things in long, dense expressions. Makes it harder to read and debug later (or to add error-handling). Sometimes minimizing variable use is not a viable option.

It's worthy of some thought. In the example...

it seems like it would be additional complexity to distinguish/escape a <tag> or #issue that you want to keep in the APPEND expression.

2 Likes