comp.lang.ada
 help / color / mirror / Atom feed
* Spoiled by Ada
@ 2016-08-04 16:31 G.B.
  0 siblings, 0 replies; only message in thread
From: G.B. @ 2016-08-04 16:31 UTC (permalink / raw)


Having used named integer types in Ada programs,
I am now longing for them once more, writing Swift
programs. Different Int16s, say, read from the data
store, to be different to the compiler. Like

    type Weight is new Integer range 1 .. 100;

Nope. Not here. The closest easy analog is typealias-ing.
(Maybe also a RawRepresentable struct, seems a hack.)

While it is a pleasure to see many features known
to Ada programmers in Swift (e.g. ranges, complete
case distinctions, a discussion of Cursor vs Container
for Swift 3 SE-0065, I see something new every day...),
it is sad that one cannot derive new numeric types.
(IINM)

So, either don't do that, or proudly manage writing
your own number types, leveraging whatever swirling
protocols and compiler-checked auto-conversions, and
operator definitions you'll think of. Slightly bitter.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-08-04 16:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-04 16:31 Spoiled by Ada G.B.

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox