comp.lang.ada
 help / color / mirror / Atom feed
From: "G.B." <bauhaus@futureapps.invalid>
Subject: Spoiled by Ada
Date: Thu, 4 Aug 2016 18:31:01 +0200
Date: 2016-08-04T18:31:01+02:00	[thread overview]
Message-ID: <nnvqk5$60a$1@dont-email.me> (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.


                 reply	other threads:[~2016-08-04 16:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
replies disabled

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