Skip to content

Commit

Permalink
feat(d): add DLang support
Browse files Browse the repository at this point in the history
## 2.0.0

### Breaking changes

- Enums can now only contain the same type. This simplifies their usage greatly
  in languages that either force you or allow you to choose a backing type for
  your enum values. It's a breaking change because of the lack of flexibility
  caused by enforcing only one type, but I think that it's a reasonable change
  overall.

### Added DLang

D was added as a beta language. It needs to be tested in production.
  • Loading branch information
GoNZooo authored Oct 9, 2022
2 parents 8c0e6aa + fc5da69 commit 0b70ba9
Show file tree
Hide file tree
Showing 33 changed files with 1,692 additions and 14 deletions.
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## 2.0.0

### Breaking changes

- Enums can now only contain the same type. This simplifies their usage greatly
in languages that either force you or allow you to choose a backing type for
your enum values. It's a breaking change because of the lack of flexibility
caused by enforcing only one type, but I think that it's a reasonable change
overall.

### Added DLang

D was added as a beta language. It needs to be tested in production.

## 1.1.0

### General
Expand Down Expand Up @@ -28,4 +42,4 @@
### Fixes

- Clearing definitions & declarations on module parsing success *and* failure
- Using debouncing to handle duplicate file events when using `--watch`
- Using debouncing to handle duplicate file events when using `--watch`
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,19 @@ can't personally vouch for them in a production context right now.
- Kotlin
- Haskell
- F#
- D
- Python

## Planned support

- PureScript
- Elixir
- D

## Maybe supported in the future

- Swift
- Scala 3 (if it's better now)
- Rust

## Options you can pass to the compiler

Expand Down
13 changes: 13 additions & 0 deletions examples/basicEnumeration.gotyno
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
enum StringValues {
first = "first"
second = "second"
third = "Third"
fourth = "Fourth"
}

enum IntValues {
first = 1
second = 2
third = 3
fourth = 4
}
9 changes: 9 additions & 0 deletions examples/basicImport.gotyno
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import basicStruct

struct StructUsingImport {
field: basicStruct.BasicStruct
}

union UnionUsingImport {
ConstructorWithPayload: basicStruct.BasicStruct
}
11 changes: 11 additions & 0 deletions examples/basicOptional.gotyno
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
struct HasOptionalString {
stringField: ?String
optionalArrayField: ?[]U32
arrayOfOptionalField: []?U32
}

union HasOptionalConstructor {
DoesNot: I32
Does: ?I32
HasOptionalStruct: ?HasOptionalString
}
4 changes: 4 additions & 0 deletions examples/basicStruct.gotyno
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
struct BasicStruct {
field1: U32
field2: String
}
9 changes: 9 additions & 0 deletions examples/basicUnion.gotyno
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
struct PayloadStruct {
field1: I32
}

union BasicUnion {
HasStringPayload: String
HasPayload: PayloadStruct
HasNoPayload
}
3 changes: 3 additions & 0 deletions examples/genericStruct.gotyno
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
struct GenericStruct <T>{
field: T
}
4 changes: 4 additions & 0 deletions examples/genericUnion.gotyno
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
union GenericUnion <T>{
HasTPayload: T
HasNoPayload
}
10 changes: 9 additions & 1 deletion gotyno-hs.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cabal-version: 1.12
-- see: https://github.com/sol/hpack

name: gotyno-hs
version: 1.2.17
version: 2.0.0
synopsis: A type definition compiler supporting multiple output languages.
description: Compiles type definitions into F#, TypeScript and Python, with validators, decoders and encoders.
category: Compiler
Expand All @@ -17,7 +17,14 @@ extra-source-files:
README.md
CHANGELOG.md
examples/basic.gotyno
examples/basicEnumeration.gotyno
examples/basicImport.gotyno
examples/basicOptional.gotyno
examples/basicStruct.gotyno
examples/basicUnion.gotyno
examples/generics.gotyno
examples/genericStruct.gotyno
examples/genericUnion.gotyno
examples/github.gotyno
examples/hasGeneric.gotyno
examples/importExample.gotyno
Expand Down Expand Up @@ -84,6 +91,7 @@ extra-source-files:

library
exposed-modules:
CodeGeneration.DLang
CodeGeneration.FSharp
CodeGeneration.Haskell
CodeGeneration.Kotlin
Expand Down
2 changes: 1 addition & 1 deletion package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: gotyno-hs
version: 1.2.17
version: 2.0.0
synopsis: A type definition compiler supporting multiple output languages.
description: Compiles type definitions into F#, TypeScript and Python, with validators, decoders and encoders.
license: BSD2
Expand Down
Loading

0 comments on commit 0b70ba9

Please sign in to comment.