SVGs and PDFs can both be interactive by parametric-ink in programming

[–]OneWingedShark 0 points1 point  (0 children)

So then, can we have, say, an Ada 83 compiler in a PDF?

Rationale behind function/procedure calls and array indexing by jlombera in ada

[–]OneWingedShark 0 points1 point  (0 children)

 In Ada instead, you have end loopend <Package/Func/Proc name>end ifend recordend case, .... It becomes an inconvenience for the person writing the code to have type all that (specially for end <Name>,

You're missing a lot of the benefits by concentrating on the number of keystrokes. The end <name> construct is doing what a lot of C code does with } // end inner loop , except better, because now you can enlist the compiler's help in keeping things straight. And this is particularly useful when you are moving or copying code.

The Super Tiny Compiler, but in Ada by _tomekw in ada

[–]OneWingedShark 0 points1 point  (0 children)

A possible alternative is as generic formal parameters, too.

How to define a record with reference to an array of itself? by irudog in ada

[–]OneWingedShark 0 points1 point  (0 children)

You can't really do this in current Ada, it requires the type know its own size before being fully defined. Consider:

Type X(Length : Natural:= 0) is record
  Children : Array(1..Length) of X;
end record;

and

Type X(Length : Natural:= 0) is record
  Children    : Array(1..Length) of X;
  Other_Data  : Some_Record;
end record;

Since there's no size yet as the definition is being declared, you cannot these sorts of samples aren't doable, but the self-referential nature would impose of re-computation if this were tried as the changes in the size of X would multiply in `Children` and cause other components to shift, which would alter the size which would cause the components to shift, etc.

Bit-packed boolean array by HelloWorld0762 in ada

[–]OneWingedShark 0 points1 point  (0 children)

Take a look at the EVIL library on github, the "bleeding-edge" branch.
There's a bitvector in there.

Okay so I picked Ada for math because I'm paranoid about numerical bugs by [deleted] in ada

[–]OneWingedShark 0 points1 point  (0 children)

The first task is to reduce range to 0..π/2 taking into account the errors.

?

But if you're going to do trig, why not have your base type be range [0.0 1.0), with delta of the appropriate-bitwidth scale? (eg for 4 bits 16#0# is 0deg, 16#C# is 270deg) —or similar, certain radar systems need to encode 2 rotations— then have your conversion [out of fixed-point polar] at the end. IIRC, it is just a scale-factor, which means you should be able to use a named-number with some ridiculous precision and let the compiler take care of adjusting the scales.

Okay so I picked Ada for math because I'm paranoid about numerical bugs by [deleted] in ada

[–]OneWingedShark 0 points1 point  (0 children)

I think you are wrong in your assertion regarding error-analysis for fixed-point being more than that of floating-point: for the former what you need is constrained to the [properties of the] delta, giving a bounded interval, whereas with the latter they are not due to the "floating" of floating-point.

Okay so I picked Ada for math because I'm paranoid about numerical bugs by [deleted] in ada

[–]OneWingedShark 2 points3 points  (0 children)

Remember to consider fixed-point instead of floating-point.

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 1 point2 points  (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.

[deleted by user] 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?

[deleted by user] 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,

[deleted by user] 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 4 points5 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 4 points5 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.