[x3d-public] TypeScript SAI

Andreas Plesch andreasplesch at gmail.com
Wed Jan 15 12:55:38 PST 2020


A few more pointers:

The specification of the language is made available under an agreement
which addresses copyright and patent concerns:
https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md

I think there is only one implementation, a compiler which compiles to
ecmascript. I think the result tends to be quite readable (but then is
typically minified).

Typescript is compiled to Ecmascript, so node.js can use compiled
Typescript software. This means a Typescript Scene Construction
Interface could also serve as JavaScript SCI, after compilation.

Conversely, all valid Ecmascript software is also valid Typescript.
Existing Ecmascript libraries can be augmented by type definition
files which are recognized by the compiler and enforce then types:
https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html

This means a Javascript SCI can also serve as a Typescript SCI, after
augmentation with type definition files.

I think it would make more sense to target automated generation of a
Typescript SCI except for the fact there is more of an initial
learning step involved.

-Andreas

PS: John had mentioned JSweet some time ago:
http://www.jsweet.org/jsweet-live-sandbox/
There are examples of how Java can get translated to similar
Typescript, for inspiration. There may be also the option to actually
use JSweet to transpile the Java SAI to a Typescript SAI.

> Message: 2
> Date: Wed, 15 Jan 2020 09:20:01 -0800
> From: Don Brutzman <brutzman at nps.edu>
> To: John Carlson <yottzumm at gmail.com>
> Cc: X3D Graphics public mailing list <x3d-public at web3d.org>
> Subject: Re: [x3d-public] TypeScript SAI

> On 1/14/2020 9:42 PM, John Carlson wrote:
> > This email thread is for discussions?of TypeScript for X3D.
> >
> > Thanks,
> >
> > John
>
>  From Wikipedia:
> "TypeScript is an open-source programming language developed and maintained by Microsoft. It is a strict syntactical superset of JavaScript, and adds optional static typing to the language."
>
> https://en.wikipedia.org/wiki/TypeScript
>
> I do not see ISO or ECMA anywhere in there, so the language appears to be proprietary with open-source implementation.
>
> The fact that it extends EcmaSCript (JavaScript) version 6 means that, if we indeed create a pure JavaScript library for X3D, then we might add some syntactic sugar as needed for supporting TypeScript as well.  Similar switches could be added to extend an X3dToJavaScript.xslt library as an X3dToTypeScript.xslt converter.  I'd recommend minimizing any differences to support long-term maintainability.
>
> It is worth looking at and supporting both languages in tandem as part of our open-source X3D implementations.  Possibly the TypeScript additions will become part of future EcmaScript standard, and possibly their design capabilities for large-scale applications will aid in our quality assurance (QA) of the Javascript library itself.
>
> Have fun with X3D!  8)
>
> all the best, Don



-- 
Andreas Plesch
Waltham, MA 02453



More information about the x3d-public mailing list