Open specing opened 6 years ago
when 0-9 =>
syntax does not worknote for 4: r := n rem 16;
works.
Sometimes it does not warn/error out when a function has no return statement. It could be related to a raise
being nested inside.
How does one do simple integer division? natural /constant produces a real number.
Unable to define two functions with the same name but different types in argument lists (string and character).
In SparForte, the syntax rules are that end must be follow with a word describing what is being ended. This not only checks for criss-crossed designs, but is helpful when conditional and loop statements are very long. While it is certainly possible to make the second word optional, it is intentionally designed this way to improve code quality and readability.
SparForte uses the Ada notation for bases, not the C convention. That is, base#value#. I cannot remember if that's fully supported throughout the language or not. It's been a long time since I used it.
This is lacking context. Did you declare constraint_error as an exception? It is not a built-in exception.
A case statement always takes a single variable, not an expression.
"Command completion in shell mode is not working". It works for me. Can you give an example?
SparForte doesn't save your commands to a history file or reload them on startup. That's not implemented.
The SparForte version can be see with spar -V, or using the System package.
Yes, it sounds like the documentation is incorrect.
The syntax is when 0..9 =>.
Since I recently added raise...when and return..when, that is, since I made them conditional, SparForte can no longer be certain that simply seeing "raise" or "return" and further statements is unreachable code. This is a known issue.
In SparForte, all literal numbers of universal_numeric (which is a float type). You can cast number results to an integer with integer() or assign the values to an integer variable, which implicitly casts the results. For example, i : integer := 3/2; should work as you expect.
Correct. SparForte does not have name overloading. At least, not yet. Each function requires a unique name.
For the difference between rem and mod, see https://stackoverflow.com/questions/20013334/difference-in-ada-remainder-operators#20013826
Cannot rename this?
type BadSectorList is new doubly_linked_lists.list(natural);
^ doubly_linked_lists.list is a generic type, not a type or a subtype
???
function read_map_file (path: string) return doubly_linked_lists.list(natural) is
^ is expected
That is reasonable for long pieces of code, but could this be made optional if e.g. there is not more than 10 lines between start and end? With a loop on 3 lines it IMO makes readability worse.
Ok, but when script it can reasonably be expected that we will also need to parse the C convention of giving numbers in different bases (such as me right now).
I did not as Spar itself gave me a constraint error before so I had assumed it would be built-in.
Why?
=> bas
spar -V on a non-release version still gives me the last release,. Usually dev builds of programs print last_release + number_of_commits + commit_id or similar.
I see. No idea what had me try to subtract in there.
when 0..9 => s := strings.val(numerics.pos('0') + r) & s;
^^ '=>' expected
Thank you for your questions and feedback. For general questions on SparForte, you can sign up to the mailing list on the website.
I understand your concern about readability. I want to keep things simple and consistent. I do not think "end if" reduces readability.
It depends on priority, time and contributors willing to tackle this issue. This is a project done in my free time. I will note this issue in the TODO file, if it is not there already. For now, can use convert the number to base 10?
That appears to be a sparforte bug. It should say the identifier is not declared. I will note this in the TODO file.
That is the restriction in the Ada language on which SparForte is based. The Ada Reference or Rationale Manuals may give insight into the decision. As it hasn't been anissue, I haven't changed the behaviour in SparForte.
SparForte uses the same GNU readline library as Bash, and has the same behaviour. Pressing tab once autocompletes if there's only one match. Pressing tab twice shows a list of the alternatives.
I'm not doing anything so elaborate with the version numbers. I usually increment the number one over the previous release. Releases are relatively slow.
Double-checking the documentation...case ranges aren't supported yet. You can achieve the same effect using if statements. I will make a note in the TODO file.
if i in 1..5 then
Parameterized built-in types are a recent feature. I don't think these types can be renamed yet with type or subtype.
Only scalar types can be used in expressions and returned. This is a known limitation. I have to rewrite the expression parsing to support multiple values. Try using a global variable for the linked list, if that is possible.
Ken B.
The incorrect error message when raising a non-existent exception has been fixed.
SparForte's configure script now has a "released" flag. Development builds (not including the --released flag) will have the build date in the prompt and in the -V version message.
How about having configure run git describe
, which at the latest head returns v2.1-142-g26a640d
and putting that into src/world.ads.orig
where the version is hardcoded? After git checkout v2.1
it naturally returns v2.1
.
Well, (1) the project doesn't necessarily run under Git, so it would have to be optional; (2) what is the priority on this over the other concerns you have?
(1) It does not run under git, but it is compiled under git and the result of git describe
can be hardcoded into SparForte. Similarly when a release is done, the release script can run this in order for the source distribution package to have the correct version.
(2) there is no priority for any of them
All issues based on 2eb28f7a4d6c8cf7157b2010078d3cf3c6774de0:
the rules around
end loop;
,end if;
,end <name>;
, ... could be made more lax such thatend;
would be enough.Is there a way to read a number in arbitrary base? Specifically
numerics.value
does not understand0x...
notation.Huh? Shouldn't it be an exception?
How does one use rem and mod in scripts?
Command completion in shell mode is not working
When spar is restarted, command lines issued from previous sessions are not loaded.
neither start-up greeting
Type "help" for help
norhelp
print SparForte version.pkg_cmdline.html: s := command_name - number of environment vars
in documentation is wrong? (it does not make sense).