unisonweb / unison

A friendly programming language from the future
https://unison-lang.org
Other
5.74k stars 268 forks source link

don't reset numbering between every command? #1364

Open aryairani opened 4 years ago

aryairani commented 4 years ago

I keep running into this sort of situation:

.temp> ls

  1. base/  (470 definitions)
  2. base_/ (470 definitions)

Okay. I don't want these, and I want to delete them.

I can't delete.namespace 1-2, so I will issue it as two separate commands.

.temp> delete.namespace 1

  Removed definitions:

    1.   builtin type Boolean
    2.   builtin type Bytes
    3.   builtin type Char
    ...

.temp> delete.namespace 2

  extra characters after temp.base.Bytes: "##Bytes"

.temp>

I meant the thing that was 2 when I decided I was going to delete both namespaces!

We could have a command to reset the numbering if it gets too big for people? Although that system seems bad too.

pchiusano commented 4 years ago

@aryairani what about 1a, 1b, 1c, etc. Each numbered output gets a suffix (which user is informed of at the end of any pretty printed numbered output). Latest command numbering can be accessed like now, with no suffix, but you can also look back to find the suffix of a previous command, and say view 4m or whatever.

This is shorter to type, avoids difficulty of when to reset / wrap the numbers (don't want to do it mid-command), and gives easy access to last 26 numbered outputs.

aryairani commented 4 years ago

@pchiusano Hmm.

wrt

Latest command numbering can be accessed like now, with no suffix, but you can also look back to find the suffix of a previous command, and say view 4m or whatever.

I feel this wouldn't solve my initial problem — my brain enqueues "delete 1", "delete 2", but due to side effects, "2" is changed.

Also, it's a little crazy.

But it might work? Ranges would have to be like 1-6k 😬

pchiusano commented 4 years ago

You could also just show 1b, 2b etc in the original output. Ranges do look a little funny with this approach, though 1-10 range could still refer to latest output.

aryairani commented 4 years ago

@pchiusano @runarorama WDYT about numbered prefix?

.temp> ls

  1.1. base/  (470 definitions)
  1.2. base_/ (470 definitions)

Okay. I don't want these, and I want to delete them.

I can't delete.namespace 1-2, so I will issue it as two separate commands.

.temp> delete.namespace 1

  Removed definitions:

    2.1.   builtin type Boolean
    2.2.   builtin type Bytes
    2.3.   builtin type Char
    ...

.temp.> view 2.1-3

 ... doesn't bomb ...

.temp> delete.namespace 1.2

But also I think we should just switch to a richer structure than strings.

pchiusano commented 4 years ago

1a 1b etc?

I was also thinking just reseting every 999 entries might work fine.

aryairani commented 3 years ago

Sometimes numbering resets even within a single command:

.tmp> delete.term 1

  ⚠️

  I couldn't delete

    1. tmp.hello : .base.Text ->{.base.IO} ()

  because it's still being used by these definitions:

    1. tmp.runHello : '{.base.IO} ()
sellout commented 2 months ago

Sometimes numbering resets even within a single command:

This particular case doesn‘t seem to exist any more, but if there are others like it, it’s simply a bug, right? We should probably avoid numbering anything that doesn’t get put into numberedArgs.