Hi,
@0x8bc5b84ae7dd5db8;
struct Game{
id @0 :UInt32;
c1 @1 :List(UInt32);
c2 @2 :List(UInt32);
t @3 :List(UInt32);
balls @4:List(UInt8);
cardState @5:CardStateMap;
cardIndexByNumber @6:Data;
}
struct CardStateMap {
contents @0:List(KV(UInt8,CardState));
struct CardState{
r1 @0:UInt8;
r2 @1:UInt8;
r3 @2:UInt8;
}
}
struct KV(K,V){
k @0:K;
v @1:V;
}
the code above is the exact code from my file and when I try to compile
I get the following error
On Mon, May 4, 2020 at 6:28 pm, Kenton Varda <ken...@cloudflare.com>
wrote:
Hi Nikos,
If you'd like us to help you, you need to provide the exact code you
actually wrote, and the exact error it produced.
The code you provided in your first e-mail has numerous syntax errors
such that it can't compile as-is. When I fixed those errors, it
worked fine. That is, if I put the following in a file and compile
it, I get no errors:
@0xc39ccf0ba082696f;
struct Foo(A) {
field @0 :A;
}
struct B {}
struct C {
field @0 :List(Foo(B));
}
So, I do not know what problem you are actually having.
-Kenton
On Mon, May 4, 2020 at 6:21 PM nikos efthias <nikos.efth...@gmail.com
<mailto:nikos.efth...@gmail.com>> wrote:
I need a List(foo(b)) that is the problem capnp compile command
generates an error sayingI need to pass pointers rather than b itself
so I cant compile my schema because it need a pointer type at
compile time and you are saying there is no such thing in capnproto
which makes using generics impossible in nested levels as i
understand
On Tuesday, May 5, 2020 at 3:12:40 AM UTC+4, Ian Denhardt wrote:
"Pointers" aren't an explicit thing in the schema language. Data,
Text,
structs, lists and interfaces are implicitly pointers, while
primitive
types like Bool and Float64 are not. Type parameters must always be
pointer types. So in this case you can just do:
struct Foo(A) {
field @0 :A;
}
struct B{};
struct C {
field :List(B);
}
-Ian
Quoting nikos efthias (2020-05-04 18:01:44)
> I have a Struct containing generics which accepts another
struct such
> as
> ```
> struct foo (a){
> � � � field @0 :a
> }
> struct b{}
> struct c{
> field:List(a(b)
> }
> ```
> the example above wont work because I need to pass a b pointer
to a but
> There is no documentation for defining pointers
> I tried *b and &b which does not work.
> How do I define the pointer?
>
> --
> You received this message because you are subscribed to the
Google
> Groups "Cap'n Proto" group.
> To unsubscribe from this group and stop receiving emails from
it, send
> an email to [1]capn...@googlegroups.com <>.
> To view this discussion on the web visit
>
[2]<https://groups.google.com/d/msgid/capnproto/bd400995-9d98-4caf-8e10->
> 81a3fe1de564%40googlegroups.com <http://40googlegroups.com/>.
>
> Verweise
>
> 1. mailto:capn...@googlegroups.com <>
> 2.
<https://groups.google.com/d/msgid/capnproto/bd400995-9d98-4caf-8e10-81a3fe1de564%40googlegroups.com?utm_medium=email&utm_source=footer>
--
You received this message because you are subscribed to the Google
Groups "Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to capnproto+unsubscr...@googlegroups.com
<mailto:capnproto+unsubscr...@googlegroups.com>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/capnproto/d4352bf6-762a-4367-b26e-ed0f6be92018%40googlegroups.com
<https://groups.google.com/d/msgid/capnproto/d4352bf6-762a-4367-b26e-ed0f6be92018%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
You received this message because you are subscribed to the Google Groups "Cap'n
Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to capnproto+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/capnproto/TVYT9Q.HE01UOSBTIHX1%40gmail.com.