comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Unifont static compiled and stack size...
Date: Thu, 17 Aug 2023 22:04:18 -0500	[thread overview]
Message-ID: <ubmn30$40ce$1@dont-email.me> (raw)
In-Reply-To: ubhpme$370q7$1@dont-email.me

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message 
news:ubhpme$370q7$1@dont-email.me...
> On 2023-08-15 10:40, G.B. wrote:
>> 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?
>
> In general case no. Initialization cannot be decomposed into functions. 
> E.g. when requires global [yet static] data, many places to set etc.
>
> P.S. Expression functions are evil. I wonder why there is no expression 
> gotos and labels? If you sell your soul to the devil, get the whole 
> package! (:-))

Ada only allows expressions to be evaluated at elaboration time (outside of 
generic instantations), and expressions have a well-defined and simple 
control flow (even accounting for conditional expressions and quantified 
expressions, both of which implicitly appear in aggregates even in Ada 83 --  
allowing programmers to write them explicitly makes the code more readable 
than the horrible work-arounds commonly used pre-Ada 2012). Gotos and labels 
have arbitrary control flow, which can be much harder to analyze. (Janus/Ada 
converts the majority of code into an expression form for optimization --  
essentially most id statements become if expressions, and so on. It simply 
punts when the control flow is too complex to convert, so the unrestricted 
use of gotos effectively prevents most optimization as well as static 
analysis.)

If it was up to me, I would have left out declare expressions and quantified 
expressions, so the capabilities of expression functions would have been 
much more limited. But it seems valuable to be able to abstract an 
expression without changing the semantics (as requiring a separate body 
does).

                                   Randy.


  reply	other threads:[~2023-08-18  3:04 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.
2023-08-16  6:17       ` Dmitry A. Kazakov
2023-08-18  3:04         ` Randy Brukardt [this message]
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