On Mon, 19 Dec 2022 at 22:37, Steven D'Aprano <st...@pearwood.info> wrote:
> > But this much (say with a better validator) gets you static type checking,
> > syntax highlighting, and inherent documentation of intent.
>
> Any half-way decent static type-checker will immediately fail as soon as
> you call a method on this html string, because it will know that the
> method returns a vanilla string, not a html string.

But what does it even mean to uppercase an HTML string? Unless you
define that operation specifically, the most logical meaning is
"convert it into a plain string, and uppercase that". Or, similarly,
slicing an HTML string. You could give that a completely different
meaning (maybe defining its children to be tags, and slicing is taking
a selection of those), but if you don't, slicing isn't really a
meaningful operation.

So it should be correct: you cannot simply uppercase an HTML string
and expect sane HTML.

I might be more sympathetic if you were talking about "tainted"
strings (ie those which contain data from an end user), on the basis
that most operations on those should yield tainted strings, but given
that systems of taint tracking seem to have managed just fine with the
existing way of doing things, still not particularly persuasive.

ChrisA
_______________________________________________
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/7GVERAPFWRAX463V24IYRKG5HIPYQ23I/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to