Comments (5)
Could you elaborate a little bit on a) why and b) what that means?
Specifically, I get these warnings
warning: [UNSUPPORTED] Ignoring default value "" for text field foo.
warning: [UNSUPPORTED] Ignoring non-null default for list field bar.
for these fields
foo @1: Text = "";
bar @2: List(UInt32) = [];
from capnpc-rust.
Ah, good point. We probably shouldn't be emitting a warning when an explicit default matches whatever the implicit default would be.
These field definitions, with explicit defaults:
foo @1: Text = "";
bar @2: List(UInt32) = [];
have the same meaning as these definitions with implicit defaults:
foo @1: Text;
bar @2: List(UInt32);
In general, every field always has a default. The implicit default for a primitive field is zero. The implicit default for a list field is the empty list, and the implicit default for a struct field has a zeroed data section and an all-null pointer section.
For pointer fields, you can distinguish between "default" and "null" by using a has_foo()
accessor. If you call get_foo()
and the foo
field contains a null pointer, you'll get the default value.
from capnpc-rust.
I've somewhat improved the situation here: 4216741
Unfortunately, it's not trivial to detect when the warning should be suppressed in the List
and Struct
cases.
from capnpc-rust.
Could you elaborate a little bit on a) why
The warning is to make sure you're aware that pointer defaults are currently unimplemented in capnpc-rust.
Of course, the long-term solution here is to actually implement pointer defaults. I think doing so should be fairly straightforward, but I haven't done it yet because I haven't needed to.
from capnpc-rust.
Fixed in: capnproto/capnproto-rust@f9ae25c
from capnpc-rust.
Related Issues (20)
- Need more info in log HOT 1
- Porting codegen to use syntex_syntax (ie rustc's libsyntax) HOT 3
- support Cap'n Proto generics HOT 17
- Premature EOF Error when running the example. HOT 5
- Compiling the example fails with "Premature EOF" HOT 4
- from FromPointerBuilder issue HOT 2
- Importing schemas from other crates is awkward HOT 2
- generics in superclass can cause compilation failure
- How to build a list inside an union? HOT 3
- Add #![allow(dead_code)] in generated *.rs files HOT 2
- When a schema is in a subdirectory generate fails to create output directory HOT 2
- shared memory implementation - need help HOT 1
- capnpc panics when function argument contains an underscore HOT 1
- List(Interface) is unsupported HOT 1
- How to get to Builder from Reader? HOT 4
- Trying to return a union - Help needed HOT 1
- Serde support HOT 1
- File creation errors when the .capnp file is not in the current directory. HOT 2
- Hard-coded /bin/cat HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from capnpc-rust.