Reduce length of substring library block

I was wondering if we could cut back on the length of the block
image

I think position is unneeded and also inclusive isn't used in other range blocks

That's not the question he was asking! Only the first block in his picture is an actual library block; the others are evidence to support his position.

@cymplecy In principle I agree, but I'm (selfishly) reluctant to do anything that would cause me to have to track down and edit all the places in BJC that use that block.

Really this library is sort of a kludge; it contains exactly the blocks I needed while developing the curriculum. There are lots more string operations we could/should include. When I get out from under the APL library, I'll look at strings.

lol, I thought he was talking about removing blocks from the library, not reduce the length of a block in the library.

(pretty much literally what the title says)

(Replying to myself...) The reason for the word "inclusive" is that that's not how the underlying JS functions work. They think of position number n as meaning the position in between character number n-1 and character number n. So, if you work it out, that means that string subset positions a to b mean characters numbered a to b-1. This is absolutely the right thing to do in an interactive text editor, provided it also does the other absolutely right thing of using a skinny cursor icon between characters, rather than highlighting a character, which always leads to user confusion. But it's arguably not the right thing in a program interface, in which position numbers are computed.

So anyway, the block is labelled that way to clue users in that it might not be what they're expecting from other languages. (I think it'll totally be what beginners expect, though.)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.