Re: typescript [was: Re: [xsl] How to write (existential) predicates with maps/Why is there no effective boolean value for a map?]

Subject: Re: typescript [was: Re: [xsl] How to write (existential) predicates with maps/Why is there no effective boolean value for a map?]
From: "Liam R. E. Quin liam@xxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 13 Feb 2019 22:11:37 -0000
On Wed, 2019-02-13 at 15:13 +0000, Dimitre Novatchev
dnovatchev@xxxxxxxxx wrote:
> On Wed, Feb 13, 2019 at 3:08 AM Liam R. E. Quin liam@xxxxxxxxxxxxxxxx
> <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> .....
> 
> > Typescript uses structural typing, not named typing.
> 
> Actually this statement is not entirely correct -- a Typescript
> programmer can use both. To achieve strict typing, which people like
> me would prefer, just change:
>    class Student { ...}
> to
>   class Student implements Person { ...}

Kinda - i think this doesn't do what people might expect if they come
from a strict static typing world, and of course you can leave it off
and not notice... but you're right, it's a way to make that link more
explicit. However, "implements" has other effects, e.g. on subclassing
a subclass, so it's not only enabling strict(er) typing.

> I believe that offering differing typing choices (starting from no
> typing at all -- all Javascript code is valid in Typescript as
> Typescript is a superset of Javascript) is an intentionally-designed
> flexibility in the language.

Yes - to get any traction at all they needed to support existing
libraries, for one thing.

>  Of course, many developers such as myself
> would use just strict typing style, so that when the transpiler
> reports typing errors one will correct them even before compile-time.

I'd prefer that too.

Liam


-- 
Liam Quin, https://www.delightfulcomputing.com/
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Web slave for vintage clipart http://www.fromoldbooks.org/

Current Thread