Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
znehrenberg-sc committed Dec 21, 2023
1 parent f2145e6 commit 7feaf08
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ verify the build and binary from the command line.
- DataView for copy free data passing
- DateRef for copy free data passing with ownership
- Generating string names for C++ enums
- Omit optional parameters from record constructors
- Bug fixes

## Using new features
Expand Down Expand Up @@ -341,6 +342,35 @@ The C++ `Future` type has optional support for coroutines. If coroutines are
availble (eg. compiling with C++20 or C++17 with -fcoroutines-ts), then you can
use `co_await` on future objects.

## Omitting Optionals from Record Constructors
- By default, optionals will be omitted from the constructor in Djinni
- The Djinni code generator will generate two constructors for a record with optionals: one with all values and one with optionals omitted. This will minimize code disruption
- Optional behavior will be able to be switched via a usage flag for each platform.
- A new [deriving method](https://github.com/dropbox/djinni#derived-methods) specifier will be implemented so that individual records can still require all parameters

### Compiler Flags
The following compiler flags will require optionals in constructors for C++/ObjC/Java:
```
--cpp-constructor-require-optionals
--java-constructor-require-optionals
--objc-constructor-require-optionals
```

### Deriving Record
Any record can be made to have all parameters be required by specifying it as a `req` deriving record:
```
MyClass = record {
required: string;
optional: optional<string>;
} deriving(req)
```

### Omitting Convenience Constructors
Extra convenience constructors which require all parameters can be removed from optional ObjC records with a new compiler flag:
```
--objc-omit-full-convenience-constructor
```

## FAQ

Q. Do I need to use Bazel to build my project?
Expand Down

0 comments on commit 7feaf08

Please sign in to comment.