Error message: missing "with Ada.Strings.Equal_Case_Insensitive;"?

I tried

Ada.Strings.Equal_Case_Insensitive(“Aaa1”,“aaa1”)

and got the error message: missing “with Ada.Strings.Equal_Case_Insensitive;”

I included this “with statement” and everything seems OK - except that I
understand that Ada.Strings.Equal_Case_Insensitive is not a package - but a function.

You do not “with” a function?

What did I miss here?

reinert

You do like any other compilation unit.

BTW, note that this is only Latin-1 comparison. Unicode is more difficult.

Happy New Year!

OK. I expected Ada.Strings.Equal_Case_Insensitive was a “normal” function under the package Ada.Strings since it somehow looks like. I was too quick there :slight_smile:
I find it strange that it is a “standalone” child function (?).

Yes, Happy New Year (and thanks for support during 2025)
Reinert

The library is a hierarchy of compilation units, if that compilation unit is a package it can have a child compilation unit, otherwise it cannot. (Compilation units are packages, functions, and procedures.)

This hierarchy is referenced by name in context clauses, and is dot (.) separated, thus:

+ Ada
 + Strings
   + Fixed
   - Equal_Case_Insensitive
 + Text_IO
 …

denotes part of the library, with + denoting things you can add a child to, and - denoting those you cannot.

The reason that you cannot have a child of a subprogram is because of very messy edge-/corner-cases: imagine a function X that returns an object with component Y, now you cannot have a child of X with name Y as it would clash… so instead of imposing all those checks and rules on the compiler implementers (for near-zero benefit) the whole concept of having a child of a subprogram is discarded.

1 Like