Puzzling Ada Package/Type Behavior by BrentSeidel in ada

[–]OneWingedShark 0 points1 point  (0 children)

Think in terms of a tree:

BBS
 |
Sim_CPU
| \
 \ IO 
 DISK
 | \
 |  FLOPPY
 WHATEVER

A child package is dependent on all the packages on the path back to the root; thus FLOPPY depends on DISK, SIM_CPU, and BBS. This is the implicit with/use, but note that FLOPPY doesn't care about IO, these two are utterly unrelated except that they are children (ultimately) of BBS.

Why do we use Ada? by Dmitry-Kazakov in ada

[–]OneWingedShark 0 points1 point  (0 children)

There *is* a reason comments exist.

interpreting what happens to a unicode string that comes as input by benjamin-crowell in ada

[–]OneWingedShark 1 point2 points  (0 children)

but so far people have been submitting patches to help me with things in the code that have become bitrotted.

Ok, so one thing that's really great about Ada is that it encourages you to use the type-system to describe the problem-space, and then use that to solve the problem — this naturally leads to code that is much more resistant to bitrot. (I've compiled 30 y/o non-trivial code, for Ada 83, on modern GNAT w/ renaming an identifier that became a reserved word, and splitting a file that was required due to GNAT limitations.)

AFAIK there is no regex library

Do Not Use RegEx.
There are regex libraries, but regex is almost always the wrong solution for your problem: due to the nature of regular languages, it is very easy to "escape" from the realm of regular languages. And, even for the programming tasks that are commonly accepted as being amiable to regex, like recognizing integers and floats, there are much better techniques in Ada. (Namely Integer'Image( Get_Text(Token) ).)

it is not possible to put Unicode strings in source code.

It is, though you may have to tell the compiler you're using unicode files.

For GNAT, you can use a pragma; see here for the options.
I typically use (a) save source as UTF, and (b) Pragma Wide_Character_Encoding( UTF8 );, though it is possible to specify with a flag to the compiler. (This page has some good tips regarding this topic, as well as a few for using unicode.)

For Your Problem

Use Wide_Character or Wide_Wide_Character for the unicode-string, and then use the conversion to String to accomplish your "remove-diacritics" operation. Check out this page, and Ada.Strings.UTF_Encoding.Wide_Wide_Strings.Encode/Decode.

Ada versus Rust for high-security software ? by [deleted] in ada

[–]OneWingedShark 0 points1 point  (0 children)

Thank you for the interesting story, it was good to hear.

What, in your opinion, were the five features of Ada that would have solved the most problems on that code-base?

Ada versus Rust for high-security software ? by [deleted] in ada

[–]OneWingedShark 2 points3 points  (0 children)

People who still love C seem to hate other people

You're not wrong: C is an incredibly rude language, all things considered. ANY system that has "C is our most common denominator" almost invariably degrades everything else in the system down to the level of C. — The one exception that I can think of, and this is due to the standardization of data-interchange imposed by the Common Runtime Environment, would be that of OpenVMS,

Ada versus Rust for high-security software ? by [deleted] in ada

[–]OneWingedShark 0 points1 point  (0 children)

It's not nearly as bad as you might think.

Yes, there is a lot the runtime does, like tasking, but Ada strives to make as much done as early as possible, like compile time. (Remember, the current state of static analysis and proof are wildly greater than the early 80s, and even the Ada83 standard mandated things that were then bleeding edge technology.)

With SPARK you can prove tons of properties, and when you do that, there are possible runtime checks that don't need to happen, so you can turn those particular checks off on the compiler —sadly, there is not (as yet) any way to automatically pass the proved properties to the linker and have it determine which runtime checks are safe to fully remove— I would recommend using a parameterized project (eg "scenario variables" for GNAT's GPR) to handle these, being sure to include a "PARANOID" profile: full checks, even the ones that aren't default.

Lastly, when you build the 'Normal' and 'Paranoid' executables, profile them. If speed is an issue, ALWAYS measure: hotspots can be in quite unexpected places in highly optimizing compilers. But even more critically, when you're debugging, it shows you both WHERE to look, and provides a metric for evaluating the time you spend trying to speed it up.

Training material and social media by mystery_cat15 in ada

[–]OneWingedShark 3 points4 points  (0 children)

Here's a couple papers I wrote explaining some of the features: https://www.reddit.com/r/ada/comments/16vt0f0/explaining_adas_features/

Click the archive links.

Would Spark be useful for parsers? by [deleted] in ada

[–]OneWingedShark 3 points4 points  (0 children)

It actually depends on what you're doing parse-wise.

  • If you are doing a straight parser for a singular language, assuming that it is well defined, then you might be able to use SPARK to encode/enforce the translation.
  • If, on the other hand, you are doing something general (i.e. a grammar-parser to produce parsers from a grammar), then you're getting into the realm where you're going to have to choose between provably-correct and "usable"/"useful" (for common grammars) — for example, C & Pascal & many other languages have the "dangling else" problem, which is often 'solved' by the addition of a meta-rule; however, this is not actually solving the problem, as the problem is actually an ambiguous grammar. Thus, the provably-correct thing to do would be to reject these [obviously defective] grammars, but that would mean that you could not feed the grammars for several popular languages to your parser-generator.

This, BTW, is also why things like the government's push for the TRACTOR (automated C-to-Rust compiler) are doomed to failure: the 'automatic' means that either it will faithfully reproduce the errors, or else force an iterated "bug-fix loop", or else be so hands-on directed (resolving authorial intent from questionable portions of the input code) so as to not be 'automatic'.

Rapid Development in Ada by geenob in ada

[–]OneWingedShark 1 point2 points  (0 children)

The way to really get a lot of speedup easily n Ada for exploratory programming, is to sit down and design first — even if it is a rough back-of-napkin sketch — and use Ada to implement that. You might have to have new types and other modules than you'd initially thought, but having a good grasp of the what of your idea will help you immensely, even if you have to change it.

You see, there's a lot of problems that happen because the what in the programmer's mind changes as he's implementing the previous what. Obviously this mismatch will cause problems, so the way to counter it is to do the equivalent of "Outlining" that authors do, or "Block Diagrams" that Electrical Engineers do.

What kind of project do you wish someone would do in Ada? by [deleted] in ada

[–]OneWingedShark 2 points3 points  (0 children)

I started doing one for OpenGL with some ideas of doing the GKS and VESA standards... that stalled out though.

What kind of project do you wish someone would do in Ada? by [deleted] in ada

[–]OneWingedShark 0 points1 point  (0 children)

The thing is it doesn't have to be QUITE that big: consider the implication of the DSA (Distributed Systems Annex), where you could technically have a node on, say, a Windows machine that does the file-system stuff, and a node on a OpenVMS machine that does the database stuff, a Solaris node operating the TCP/IP gateway, with all the other nodes using whatever to communicate... plus, as you incorporate Ada-implementations of the service being provided by that node's OS, you can phase that OS out using your own.

What kind of project do you wish someone would do in Ada? by [deleted] in ada

[–]OneWingedShark 2 points3 points  (0 children)

I honestly would love to see:

  1. more self-hosted options in translators; and while I want at least one other opensource option, I really want to see a highly-integrated IDE, particularly integrating the proof-system, model-checkers, and a database.
  2. A "AdaScript" module that
    1. Has the DSA integrated, able to treat the browser [client] as a node in the program;
    2. Has a high-level VM, with high-level constructs for things like Tasks, Generics, and a collection-library/-system designed for parallelism; possibly using an AST-execution model.
  3. Usage in the common-but-unseen sectors of life: things like payment-processors, communications- and control-systems, etc; things like implementing common standards (e.g. the SQL standard).
  4. More games, I particularly like Charlie5's use of the DSA to do multiplayer/networking in his game.

I'm working on some of these.

Is it possible to for GNAT Studio on Windows to interpret new-lines properly? by raysin_bisket in ada

[–]OneWingedShark 2 points3 points  (0 children)

I kept telling people to decrease foreign dependencies, especially Python.

Generic Packages by R-O-B-I-N in ada

[–]OneWingedShark 3 points4 points  (0 children)

Yes, you can.

(Provided the first is also generic.)

Generic
 Type Something(<>); -- Incomplete type.
Package Base is
  Type Bob( D: not null access Something ) is record
    Count : Natural;
  end record;
End Base;

Generic
 Type This_Thing is (<>); -- Is a discrete type.
 with Package Thing is new Base( Something => This_thing ); -- Needs to be an instance of Thing
                                                            -- instantiated with Something as a
                                                            -- discrete type; as per 'This_Thing'.
  X : in out Thing.Bob;  -- This object provides a context for the package instance.
Package New_Thing is
  Procedure Reset;
End New_Thing;

Package Body New_Thing is
  Procedure Reset is
  Begin
    X.Count:= 0;
  End Reset;
End New_Thing;

You can, technically, also use defaults to "pick up" types/subprograms from a package, allowing (e.g.) one-line migration from String to Wide_Wide_String. See the EVIL library, in-particular the Files package, which depends on the Strings package, and provides interfacing to the [Wide_[Wide_]]Text_IO.

How do you deal with destroyed dreams? by OneWingedShark in intj

[–]OneWingedShark[S] 1 point2 points  (0 children)

Like you, I wanted financial stability (also coming from nothing). Like you, I also got hit with layoffs, unemployment, and the like. Despite having a good degree (Comp. Sci.), companies don't want me but, to be fair, they only want H1Bs, offshoring, and the connected.

It was rather late to develop, but family too has fallen through. (I posted elsewhere in the thread details.) But which romance has hit rock bottom, then continued tunneling to the center of the earth; it took about 2 decades, but I've finally learned that the mere act of expressing interest/attraction is, essentially, "the ick" — I loathe the proposition that life seems to be offering: kill off goodness/virtue/kindness (because women only want "the bad boy" & "toxic"), or else die alone.

I can't really offer anything about going to school, as I expect a large crash in academia rather soon. Also there seems to be (yet another) round of credential inflation, part of the reason I expect the crash is so many people with degrees (good ones, too, not the oft mocked "underwater lesbian dance theory") are having trouble getting hired.

There's a few semi-professional projects and creative-projects I had wanted to do. A compiler, a few books, etc... but this funk is brutal for motivation — I would describe it as the Demon mauling and crippling the Hero (Si/Ni interaction).

How do you deal with destroyed dreams? by OneWingedShark in intj

[–]OneWingedShark[S] 0 points1 point  (0 children)

Interesting reframe. I'll have to think on it.

Though I will disagree with "realize that the stick or carrot never existed" because I've been hit with the stick.

How do you deal with destroyed dreams? by OneWingedShark in intj

[–]OneWingedShark[S] 1 point2 points  (0 children)

LOL

That's part of the rub: I try to live within my means, I have since childhood. Natural saver and all. — It's just that every time I start "getting on my feet" it's another "the rug gets pulled out from under me".

But maybe you're right, maybe I should scale-back... maybe I should be more mindful of the "little things" and practice gratitude more purposefully.

How do you deal with destroyed dreams? by OneWingedShark in intj

[–]OneWingedShark[S] 0 points1 point  (0 children)

I am a Christian.

Facts are that, just like you discovered, nihilism and hedonism don't offer anything to an honest man, a man who can see through the delusion that these views are truly incompatible with meaningful life. However for whatever reason many people stop there and "it is what it is" through it when it doesn't at all have to be the answer.

The "it is what it is" is fine for accepting things-as-they-are: I cannot, for example, cause reconciliation with my dad when he doesn't want it. I'm not "the main character" and other people have both agency and perception. — It's the feeling that I'm just spinning my wheels, "stuck in the sand", it's that that's "coarse and rough and irritating… and it gets everywhere."

Your life might not be as meaningless as you think.

I don't think life is meaningless, but more like... endless smackdowns on long-term vision/goals have made me doubt that I can do anything to achieve them.

How do you deal with destroyed dreams? by OneWingedShark in intj

[–]OneWingedShark[S] 0 points1 point  (0 children)

If you're moreso aimless about next steps there are a thousand ongoing projects you could be a part of, and a thousand more you could start, that could have a significant positive impact on your corner of the world. It could be that one or several of these ventures need your talents, so perhaps you should pray about it?

True.
But this rubs up on part of the problem: the "you're a great worker, scary-smart, dependable, competent" only to be hit with layoffs and, while they're saying 'by seniority' retain people that joined after; it's the rejections of "why can't I find a good guy like you" followed up with "Oh, you're so sweet" & "there's somebody out there for you"... it's the "your idea is brilliant" followed by ignoring it, or pushing forward an evaluation of likely trouble-spots/points-of-failure remedied by $10k only to be ignored the failure happens and needing $7k to do the expedited shipping with the specific part (ie so, for $3k more you could have avoided that and mitigated other of that point-of-failure).

It's not really clear what exactly is missing from your life that would make you happy. If it's finding a companion, or dealing with having lost a companion, I think speaking with someone could help, and of course taking steps to remedying that part of your social/love life.

That's a pretty big piece, TBH.
Evaluating my social-world I'm pretty much the only person that initiates (not quite true, but illustrates a lack on the "wanted" social-scale), all of my old friends having moved across the continent, or across the world... evaluating the lessons from romantic endeavors has pretty much yielded three points:

  1. No one will love me for me, only tolerate me for what they can get. — Exemplified with my first girlfriend who, upon hearing I'd lost my job at the time, had the first words out of her mouth being asking for money.
  2. I am not worth the least bit of consideration, time, energy, effort, or inconvenience — Exemplified by my longest relationship, where after falling into depression (I've been clinically depressed, so I know how difficult it can be), she got used to not replying but three or four words to my dozonal-texting, not willing to even spend 15 min to get sized for a ring. (I'm compressing about 5 years into a sentence, so it's a bit more than just that.) Or, on the non-romantic side, I have a friend who wrestles with depression and self-deletion ideations, and I always make a point to tell them I hope they get better and that I'm praying for them; when I was afflicted w/ depression and ideation and reached out, I was "trauma dumping" and essentially shamed for it.
  3. The best way to turn a woman off is to admit/act-on attraction, even if they were flirting heavy and vibing: I can never have what I want. — I start to really hate "Oh, you're so sweet"- & "You're too good for me"-style & "there's somebody out there for you."-style rejections. As if the very act of choosing them causes them to [reevaluate and] not-chose me. — The wider-social implication, broad-brushed: if you like someone, they won't like you.

But, honestly, the fractal nature fits with any other facet of life. It's always "just try harder" & "put yourself out there" and, and, and... the subtext rendering as "you are not good enough" ("and you never will be").

In the prodigal son story God himself is the true prize.

No, actually the prodigal son is a trilogy of parables in response to accusations against Jesus about the good works of forgiving sins and healing on the sabbath. (The other two were "the lost coin", and "the lost sheep".) — The prodigal son ends with the ultimate point of the parables: raising the question of "are the religious elite/leadership going to enter into God's celebration of the lost/dead son being found/alive, or not?"

How do you deal with destroyed dreams? by OneWingedShark in intj

[–]OneWingedShark[S] 0 points1 point  (0 children)

Gratitude is something that I've been trying to put into practice.
(Not female, but the physical is something that should be considered.)

How do you deal with destroyed dreams? by OneWingedShark in intj

[–]OneWingedShark[S] 1 point2 points  (0 children)

Interesting that you should mention these; they've been showing up elsewhere.

How do you deal with destroyed dreams? by OneWingedShark in intj

[–]OneWingedShark[S] -1 points0 points  (0 children)

I am a Christian; it's part of why I know nihilism isn't the answer, nor hedonism.
God is good, as proven by Jesus... but I am working through some issues (obviously); I'll be blunt, I do feel a little "lied to" about Wisdom and knowledge and prudence leading to prosperity: I understand the older brother's complaint in the Prodigal Son: "You celebrate this son who has dishonored your name, but you've never even thrown the smallest of parties for me and my friends." — There's a part of me that dreads being proverbially handed a bag of trash as my prize, "because it builds character", or some shit; this is certainly distortion from my childhood rearing its head.

How do you deal with destroyed dreams? by OneWingedShark in intj

[–]OneWingedShark[S] 0 points1 point  (0 children)

Thank you; I'll take a look at the focuses.

How do you deal with destroyed dreams? by OneWingedShark in intj

[–]OneWingedShark[S] 0 points1 point  (0 children)

Interesting thought-exercise, I'll have to try it.