From: xorque <xorquewasp@googlemail.com>
Subject: Re: Choices for modelling binary packet protocol in SPARK
Date: Sat, 18 Jul 2009 23:47:19 -0700 (PDT)
Date: 2009-07-18T23:47:19-07:00 [thread overview]
Message-ID: <2c560673-0158-4968-b182-5aef9cfe8501@a26g2000yqn.googlegroups.com> (raw)
In-Reply-To: ea89c015-6d8d-4ef0-a0ed-f9960a980c99@d4g2000yqa.googlegroups.com
On Jul 18, 12:23 pm, Phil Thornley <phil.jpthorn...@googlemail.com>
wrote:
> As a rule, SPARK (and high-integrity code generally) avoids
> programming tricks - because the code becomes more error-prone for the
> author, reviewer and compiler.
Certainly.
> If the individual records are fairly small, is an ordinary record
> acceptable:
> type P_Type is record
> Option : P_Option_Type;
> Timestamp : Integer;
> P1 : P1_Type;
> P2 : P2_Type;
> end record;
Unfortunately, some of the records may be up to 256kb in size (which
was the main motivation for a "union" type in the first place).
> Alternatively the language supports inheritance via tagged types, but
> with restrictions (no class-wide programming, only one derived type
> per package).
Right.
> A different approach would be to use Unchecked_Conversion for the
> individual record types, defining their layout with representation
> clauses to get the correct format of the byte array...
Yeah, I think this might be what I'll be doing.
xw
next prev parent reply other threads:[~2009-07-19 6:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-18 6:46 Choices for modelling binary packet protocol in SPARK xorque
2009-07-18 11:23 ` Phil Thornley
2009-07-19 6:47 ` xorque [this message]
2009-07-21 14:13 ` Hibou57 (Yannick Duchêne)
2009-07-21 14:13 ` Hibou57 (Yannick Duchêne)
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox