Hello,

On Wed, 24 Feb 2021 05:01:37 +1100
Chris Angelico <ros...@gmail.com> wrote:

> On Wed, Feb 24, 2021 at 4:59 AM Paul Sokolovsky <pmis...@gmail.com>
> wrote:
> > Without getting to the root cause, there will be only workarounds of
> > different level of ugliness. For example, any reasonable JIT would
> > implement proper semantics - param checking *inside* functions (just
> > like the C code does now).  
> 
> Why do you assume that this is "proper semantics"? I'm confused. What
> is it that makes function parameter matching inherently part of the
> body of the function?

The same what causes C-level function implementations to do parameter
checking themselves. There's simply nowhere else to put that checking,
and of course nobody calls C functions via an intermediary - that's
hilariously inefficient. All those points apply to JITted functions too
(you JIT to make it fast, then putting a slow bottleneck inbetween,
which will also confuse CPU branch predictors - doesn't make sense).

> For one thing, that notion is semantically incompatible with multiple
> dispatch, where matching parameter numbers or types determines which
> function is even going to be called.

Python doesn't support multiple dispatch. Majority of languages don't
support multiple dispatch. For a well known reason - its benefits vs its
inefficiency ratio is very low (inefficiency is high). So, whichever
runtime system implements multiple dispatch, will need to think about
its issues, including aspects of error reporting, I don't see how
that's relevant to Python discussion.

(Multiple dispatch is also effectively a poorman's, implicit pattern
matching which works only between code blocks factored out into
functions.)

[]

-- 
Best regards,
 Paul                          mailto:pmis...@gmail.com
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/WGBXU3IMUDOHPBJMRPHOVOIODJBYPZWA/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to