<nate_prime>
so a type has a cstruct definition? because `arp` is defined as a type on line 23 and as a cstruct on line 45?
<nojb>
those two are completely independent
<nate_prime>
thanks for the use case and clarification
<nojb>
the arp *type* is just the type of data structure that is used to keep track of the state of ARP
<mort___>
yes — the cstruct { } is simply used to generate set/get accessors into a bigarray via the syntax extension
<mort___>
(iirc)
<nojb>
the arp *cstruct* is just a syntax extension (camlp4) that defines a bunch of getters and setters that are named {get,set}_arp_*, one for each field
<nate_prime>
so if I want to parse a simple message like "*2\r\n", is using a cstruct even the right move?
<nojb>
that depends - Cstructs are used pervasively in the mirage IO infraestructure, so it is convenient to use them in order to avoid having to convert back and forth to some other datatype (like strings)
<nojb>
in other words - cstructs are just byte buffers
<nojb>
the syntax extension will help you if you are parsing binary protocols
<nojb>
for text protocols it doesn't really make that much of a difference
<nate_prime>
part of the protocol is text (redis protocol). It seems like it is maybe possible to do it without cstruct and just use io_page?
<nojb>
Io_page handles memory allocation - I don't think it will help you much ...
<nojb>
my suggestion is to think what you want to do as if you were dealing with plain old strings - afterwards it is rather easy to translate that to cstructs
<nate_prime>
sorry for my confusion, I'm generally feeling lost with the mirage libraries. I'll give it a try with strings and then attempt the translation
<nojb>
imho, it is better to just forget about mirage at first, write your code and then (only then) make it a functor of the mirage signatures in order to port it to mirage
andreas has quit [Quit: Leaving.]
guillain has quit [Ping timeout: 240 seconds]
guillain has joined #mirage
brson has joined #mirage
nojb has quit [Quit: nojb]
mort___ has quit [Quit: Leaving.]
jonludlam has quit [Ping timeout: 240 seconds]
nojb has joined #mirage
nojb has quit [Client Quit]
dsheets has quit [Ping timeout: 256 seconds]
dsheets has joined #mirage
MrScout has quit [Ping timeout: 245 seconds]
MrScout has joined #mirage
mort___ has joined #mirage
nate_prime has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
M__ has quit [Ping timeout: 246 seconds]
MrScout has quit [Remote host closed the connection]
tlockney is now known as tlockney_away
MrScout has joined #mirage
thomasga has quit [Quit: Leaving.]
justincormack has quit [Ping timeout: 256 seconds]
nojb has joined #mirage
nojb has quit [Client Quit]
thomasga has joined #mirage
tlockney_away is now known as tlockney
nojb has joined #mirage
jonludlam has joined #mirage
mort___ has quit [Quit: Leaving.]
mort___ has joined #mirage
mort___ has quit [Quit: Leaving.]
andreas has joined #mirage
justincormack has joined #mirage
javamonn has quit [Remote host closed the connection]