Skip to content
November 27, 2008 / Abe Pralle

Things aren’t looking good for repeat..until

I’m probably going to cut “repeat..until” from gen2 Slag.

  • I used it literally 4 times in the 10,000 lines of the Slag standard library.
  • It can easily be replaced with a while() loop.
  • I always forget it’s there until I try and use “repeat” as a variable name.
  • Likewise, I’d kind of like to use “repeat” as a variable name again.

I guess it’s just one of those things that sounded cool but never proved itself.

Murphy mentioned the other day that every feature proposal in C# starts out with negative 100 points.  People then try to come up useful cases for the feature, each rated with some number of points to offset the initial score.  Only features that end up with a net positive score are actually implemented.

It’s a neat idea, although thankfully since Slag is just a little fish (but growing!) I can afford to just put things in & rip ‘em out later.  Anyways, “repeat..until” is currently at (-99), so I’m gonna ditch it.

Oh wait – let’s look at the MadStone source code!  Here we go.  Hmm…. zero uses.  Yep.

About these ads

2 Comments

Leave a Comment
  1. abepralle / Nov 27 2008 11:38 pm

    Addendum: furthermore, for situations where you do need repeat-until functionality, this code:

    repeat
    body
    until (condition)

    converts nicely into this:

    loop
    body
    if (condition) escapeLoop
    endLoop

  2. abepralle / Nov 27 2008 11:41 pm

    PLUS the syntax isn’t consistent with the other structures. Everything else is “structure”…”endStructure”. Contrast that with “repeat”…”until”. Ungh!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: