Add support for emitting native `class`

Description

Currently, there is no way to emit a `class` declaration from ClojureScript code.

In a JS environment that has native class support, there are certain cases with `class` that cannot be replicated with ES3/5 prototypal syntax, and require to use the environment’s native `class` and `extends` keywords.

Resolving this issue would involve two parts:

  • a `defclass` macro which provides syntax for declaring a name, superclass and methods

  • compiler support to do a second pass on the file in order to convert to ES3 if the user does not want their project to only target ES6+ environments

Environment

None

Activity

Show:
David Nolen
April 11, 2020, 12:00 AM

:language-out would control whether we immediately lower to ES3.

Juho Teperi
April 13, 2020, 8:40 PM

Another issue about ES6 classes

Assignee

Unassigned

Reporter

Will Acton

Labels

None

Approval

None

Patch

None

Priority

Major
Configure