[?] Understand sequence behaviour?

Mathematica 11.0.1.0, Windows 64 bit

Can somebody explain why in the first example “Sequence” behaves as expected, whereas in the second we have an error:

First example:

m = {{1, 2}, {3, 4}};
m[[All, 2]] = Sequence[];
mm[[2]] = Sequence[];

Second example:

m = {{1, 2}, {3, 4}};
m[[2]] = Sequence[];
m[[All, 2]] = Sequence[];

Strange indeed! However,

m = {{1, 2}, {3, 4}, {5, 6}};
m
m[[2]] = Sequence[];
m = m
m[[All, 2]] = Sequence[];
m

does work! It think it is due to that m is stored like:

{{1,2},Sequence[]}

Such that there is no second element in the second element. by doing m = m you ‘evaluate’ the Sequence. Might be the intended behavior or not, I almost never use Sequence in this way…

I would suggest using Drop, which is intended to remove elements, columns, rows, et cetera…

It is an artifact of how Sequence is implemented.

m = {{1, 2}, {3, 4}};                                                      
m[[2]] = Sequence[];                                                       

In[12]:= ??m                                                                        
(*Global`m

m = {{1, 2}, Sequence[]} *)

Resetting m (e.g. m=m as @Sander showed)forces the Sequence[] to disappear.

I was trying to show this using Hold(All)(Complete), SequenceHold or HoldForm et cetera, but couldn’t… didn’t think of using Definition…

Here is an extended discussion:

FYI, OwnValues[ m ] would do too.

Interesting! So Sequence[] is basically equivalent to Nothing ?!?

notHere[Sequence, Nothing]

Nothing only vanishes from Lists and is not affected by e.g. SequenceHold.