miss_hit icon indicating copy to clipboard operation
miss_hit copied to clipboard

Having 2 functions with the same name should throw an error.

Open Remi-Gau opened this issue 3 years ago • 4 comments

What kind of feature is this?

New feature in MISS_HIT

Your MATLAB/Octave environment

MATLAB

Octave is not affected by this

MISS_HIT component affected

I think this falls under the linter.

Describe the solution you'd like

Matlab will not use a file where 2 functions have the same name. I suspect that ms lint should flag this, no?

Example:

function temp()
end

function foo()
end

function foo()
end

Remi-Gau avatar Oct 04 '21 10:10 Remi-Gau

Yes, it definitely should; but right now there is zero semantic analysis going on.

There is a sanity check that a function name doesn't clash with some important built-ins (like true, and yes this happened for real once, just remember all safety rules are written in blood) but other than that there is nothing going on: no symbol table no name resolution, nothing.

I have a very big project ahead of me to do this, as it would enable a large number of useful checks (e.g. look at issues requiring sem that are open right now).

I plan to do this; but don't expect anything this year...

florianschanda avatar Oct 05 '21 06:10 florianschanda

In fact I've re-opened #236 and put the same labels on it to make sure I capture this

florianschanda avatar Oct 05 '21 06:10 florianschanda

I plan to do this; but don't expect anything this year...

No rush at all.

miss_hit as it is has already brought much joy and removed a lot of my pain from my every day life. So anything beyond that is just icing on the cake. :+1:

Remi-Gau avatar Oct 05 '21 07:10 Remi-Gau

That is some really nice feedback, it makes me very happy to hear that. Thanks! :)

florianschanda avatar Oct 05 '21 11:10 florianschanda