On Wednesday, July 7, 2021 at 5:15:43 PM UTC-6, Matt Borchers wrote:
BTW, what's wrong with
Gnat.RegExp? It has worked in our code for years.
Regular expressions are for regular languages; it is very easy to violate that restriction with your incoming data.
Most of my professional career has been doing maintenance, and RegEx are *terrible* when it comes to maintainability, to the point that I actively avoid them and advise others to as well, even for things that conceptually *could* be done via RegEx (e.g. recognizing an Integer) in favor of actual parsing... or if you need pattern-matching, something more robust like SNOBOL.
The RENAME is interesting as I have not seen that before. Is it a rename of the function call (invokes the function upon reference) or a rename of the function result?That form of RENAMES is the function result.
I've found it an excellent alternative to CONSTANT, as it signals my intent to have an alias for some result inside DECLARE blocks and certain internal objects. (eg Default_Map : Map renames Internal_Map_Generation(P1, P2); ... and then I can use "Default_Map" instead of calling the generation-function at each point and possibly messing things up should the parameters change.)
I think AdaCore has (or used to have) a Snobol package. Snobol wasor if you need pattern-matching, something more robust likeinteresting:-)
SNOBOL.
is it easy to integrate it in an ada program?
i'm thinking about AdaControl, which (if i'm right) uses RegEx a lot.
I think AdaCore has (or used to have) a Snobol package. Snobol was invented by
Robert Dewar...
In article <a6e2e912-8aa6-4ecf-9118-9dd29a967734n@googlegroups.com>,
Shark8 <onewingedshark@gmail.com> wrote:
The RENAME is interesting as I have not seen that before. Is it aThat form of RENAMES is the function result.
rename of
the function call (invokes the function upon reference) or a rename of
the
function result?
I've found it an excellent alternative to CONSTANT, as it signals my
intent
to have an alias for some result inside DECLARE blocks and certain
internal
objects. (eg Default_Map : Map renames Internal_Map_Generation(P1, P2);
...
and then I can use "Default_Map" instead of calling the
generation-function
at each point and possibly messing things up should the parameters
change.)
why renames is better than constant in this case ?
could you explicit the difference between them, please?
On 2022-07-06 19:56, J-P. Rosen wrote:
I think AdaCore has (or used to have) a Snobol package. Snobol was
invented by Robert Dewar...
SNOBOL was created by Farber,Griswold, and Polonsky in the 1960s. Dewar
and Belcher wrote the SPITBOL compiler in the 1970s. GNAT comes with the GNAT.Spitbol.* packages for SNOBOL-like pattern matching.
Le 06/07/2022 à 18:18, Thomas a écrit :
I think AdaCore has (or used to have) a Snobol package. Snobol wasor if you need pattern-matching, something more robust likeinteresting:-)
SNOBOL.
invented by Robert Dewar...
is it easy to integrate it in an ada program?
i'm thinking about AdaControl, which (if i'm right) uses RegEx a lot.
AdaControl uses Gnat.Regexp
"Thomas" <fantome.forums.tDeContes@free.fr.invalid> wrote in message news:62c5b5e9$0$22251$426a34cc@news.free.fr...
In article <a6e2e912-8aa6-4ecf-9118-9dd29a967734n@googlegroups.com>,
Shark8 <onewingedshark@gmail.com> wrote:
The RENAME is interesting as I have not seen that before. Is it aThat form of RENAMES is the function result.
rename of
the function call (invokes the function upon reference) or a rename of >> > the
function result?
I've found it an excellent alternative to CONSTANT, as it signals my
intent
to have an alias for some result inside DECLARE blocks and certain
internal
objects. (eg Default_Map : Map renames Internal_Map_Generation(P1, P2);
why renames is better than constant in this case ?
could you explicit the difference between them, please?
In theory, a renames captures the function result object, so for a composite type, you avoid copying it. That can be especially significant for
controlled types, where you avoid an extra Finalization
I believe there also are some
accessibility differences that might matter in unusual cases.
it is a matter of preference which to pick. (I
usually use "constant" unless avoiding a copy is necessary.)
1) Regexp is sufficient for my needsAdaControl uses Gnat.Regexpdo you have sth against SPITBOL?No, but
i find it less readable when the pointed object is constant,
since it is not remembered at the point of the renames, and one could
think that it can be changed.
in other words, at the review time we have to check at the source of the renames to know if it is constant or not.
moreover, when the pointed object is variable,
constant keyword in a renames could mean that the variable could not be modified when used with the "constant renames" identifier.
i understand that it conflicts with the rule: "the constant keyword
means that the value never changes"
i suppose that some people already thought about that ...
but i don't understant what kind of pb there can be with the 1st case,
so i would find nice to have the constant keyword when the pointed
object is one, even if it stay forbidden in the other case.
Le 11/07/2022 à 19:49, Thomas a écrit :
1) Regexp is sufficient for my needsAdaControl uses Gnat.Regexpdo you have sth against SPITBOL?No, but
2) I don't want my users to have to learn Spitbol.
Everybody knows regexp (at least the simple forms).
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 379 |
Nodes: | 16 (2 / 14) |
Uptime: | 44:59:36 |
Calls: | 8,141 |
Calls today: | 4 |
Files: | 13,085 |
Messages: | 5,858,057 |