comp.lang.ada
 help / color / mirror / Atom feed
From: "G.B." <bauhaus@notmyhomepage.invalid>
Subject: Re: Unifont static compiled and stack size...
Date: Tue, 15 Aug 2023 10:40:45 +0200	[thread overview]
Message-ID: <ubfdmd$2oi52$1@dont-email.me> (raw)
In-Reply-To: <ubcopg$27tbv$1@dont-email.me>

On 14.08.23 10:31, Dmitry A. Kazakov wrote:
> 
> P.S. I always wanted static functions in Ada for the purpose of all static initializations of objects like maps etc.
> 

If data form the equivalent of a static Ada array,
thus a mapping from an index type to a value type,
could you approximate the static initialization
of maps using expression functions?

Simplifying example:


package sttc is


   type Key is range 1 .. 7;
   type Value is new Character;
   type Cursor is private;

   function lookup (K: Key) return Cursor;
   function element (C: Cursor) return Value;

private
   type Cursor is new Key;
end sttc;

package body sttc is

   function lookup (K: Key) return Cursor is (Cursor (K));

   function element (C: Cursor) return Value is
   (case C is
    when 1 => 'M',
    when 2 => 'M',
    when 3 => 'X',
    when 4 => 'X',
    when 5 => 'I',
    when 6 => 'I',
    when 7 => 'I'
   );

end sttc;

  parent reply	other threads:[~2023-08-15  8:40 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-13 16:16 Unifont static compiled and stack size Micah Waddoups
2023-08-13 21:19 ` DrPi
2023-08-14  0:29   ` Micah Waddoups
2023-08-14  8:21     ` Dmitry A. Kazakov
2023-08-14  8:07 ` Niklas Holsti
2023-08-14  8:31   ` Dmitry A. Kazakov
2023-08-14  9:25     ` Kevin Chadwick
2023-08-14  9:30       ` Kevin Chadwick
2023-08-14  9:43         ` Dmitry A. Kazakov
2023-08-14  9:39       ` Dmitry A. Kazakov
2023-08-15  8:40     ` G.B. [this message]
2023-08-16  6:17       ` Dmitry A. Kazakov
2023-08-18  3:04         ` Randy Brukardt
2023-08-14 10:06 ` Jeffrey R.Carter
2023-08-14 15:10   ` Micah Waddoups
2023-08-14 15:59     ` Jeffrey R.Carter
2023-08-14 16:02     ` Dmitry A. Kazakov
2023-08-15  4:48       ` Micah Waddoups
replies disabled

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