r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Red] Red language group

GrahamC
26-Jan-2012
[4538x2]
or, print-
I suspect that is why the t is missing for 'prin ... but then you 
have to know what it stands for
Kaj
26-Jan-2012
[4540x2]
I've renamed the print-string in the C library binding to make way 
for the Red/System one
Sorry, print-line
Dockimbel
27-Jan-2012
[4542]
Thanks Kaj, I forgot it was defined also in C binding.
Oldes
27-Jan-2012
[4543]
Is there any doc how to write a test case? Or should I just hack 
it somehow?
Dockimbel
27-Jan-2012
[4544x2]
The testing framework done by Peter WA Wood is documented here: http://static.red-lang.org/red-system-quick-test.html
You can also browse inside %red/red-system/tests/source/ to see how 
tests are done. Basically:

- language unit tests go in %tests/source/units/<feature_name>-test.reds

- compilation passing tests and compilation error tests go in %tests/source/compiler/<feature_name>-test.reds
PeterWood
27-Jan-2012
[4546x2]
There are two additional assertions in the float-partial branch that 
you might find useful Oldes. They aren't in the documentation yet. 
They are:


--assertF~= which takes three float!s, it compares the first two 
to be equal within a tolerance supplied as a third argument. The 
tolerance is both an absolute and relative tolerance. So, a tolerance 
of 0.01 would return true if the two floats were equal + or - minus 
0.01 or within 1 percent.

I have used a tolerance of 1e-12 in testing.
The other one is --assertF32~= which is the equivalent for float32! 
datatypes. I have used a tolerance of 1E-6 with this assertion.
Oldes
27-Jan-2012
[4548x2]
I would like to write tests for enumerations: https://github.com/dockimbel/Red/pull/201
(still not finished - I must add detection if values does not exists 
already)
BrianH
27-Jan-2012
[4550]
Kaj, compatibility can't practically be measured as a whole with 
Boolean algebra. Try fuzzy logic math :)
Evgeniy Philippov
27-Jan-2012
[4551]
BrianH: that's not only fuzzy logic. That's ALL kinds of logic, not 
only fuzzy IMNSHO.
PeterWood
27-Jan-2012
[4552]
Oldes: I've emailed a skeleton test file for enum to you.
Oldes
27-Jan-2012
[4553x3]
what does backtrack ?
Also in the test doc is mentioned script run-test.r, which is not 
in repository, how to run just one test case?
(backtrack - to move back source code input cursor (PC) so it looks 
better in the NEAR field:)
Dockimbel
27-Jan-2012
[4556x2]
'backtrack function just re-position the source code cursor to point 
to the right symbol or beginning of an expression when an error is 
raised.
run-test.r: it was there until recently, I guess Peter removed it 
as we don't use it often. I guess Peter could bring it back.
Oldes
27-Jan-2012
[4558]
do we want to allow declarations like:
	integer!: func[a [integer!]][ a ]
Dockimbel
27-Jan-2012
[4559]
Ah, old question :-) There's a ticket about that opened by Rudolf...let 
me find it...
PeterWood
27-Jan-2012
[4560]
I removed run-test.r as it was becoming difficult to get working 
once we needed to have tests not only in the red-system/tests dir. 
(I now use a script in another language which seems to be more flexible 
in it's file path handling.)

I've emailed a copy of the run-test.r to Oldes.


I'll take another look at getting run-test.r to run a test from any 
directory. If I can I'll restore it, if not I'll chane the docs.
Dockimbel
28-Jan-2012
[4561]
Oldes: can't find the ticket anymore, but in a nutshell, datatypes 
should be unaffected by such declaration, they are not part of the 
same namespace as variables, so to answer your question, it is allowed 
but not recommended (there are warnings against that in the specification 
document).
Oldes
28-Jan-2012
[4562]
I know it's allowed, the question is, if it's not better to disallow 
this, or at least throw warning
Dockimbel
28-Jan-2012
[4563x4]
A warning could be added easily, the issue is that it would then 
make all datatypes names reserved words that would need to be added 
there: http://static.red-lang.org/red-system-specs.html#section-18
Sorry, I meant "An error..."
A warning might be a better solution.
And would avoid to add them in the "keywords list".
Oldes
28-Jan-2012
[4567]
should this:
	#enum test! [foo: 3]
	f: func[foo [c-string!]][print foo]
	f "bar"
throw a declaration error or print "bar"?
Dockimbel
28-Jan-2012
[4568]
Declaration error.
Oldes
28-Jan-2012
[4569]
Any idea what else should be tested? https://github.com/Oldes/Red/blob/float-partial/red-system/tests/source/compiler/enum-test.r
Dockimbel
28-Jan-2012
[4570x8]
Looking at it...
Hmm, you should have separated the compilation tests from the language 
features tests...but no problem, Peter could split that later.
A test with enum vs define?
Oh I see there's already one for that.
Multiple enums using the same name {#enum test! [...] #enum test! 
[...]}?
Setting an enumerated symbol to a value that is not an integer?
BTW, there's a `print-wide` function defined at runtime for printing 
with a blank space between values. :-)
I think that it should be enough tests for a start.
Oldes
28-Jan-2012
[4578]
done.. you can find complete diff for the pull request here: https://github.com/dockimbel/Red/pull/201/files
Dockimbel
28-Jan-2012
[4579x2]
Code review of your pull request finished. Only minor things except 
maybe for the addition in `get-variable-spec` that might cause some 
issues.
Also, do not forget to `git rebase` your forked branch to get all 
the latest commits.
Oldes
30-Jan-2012
[4581]
Why is not c-string! available in pointer-syntax rule?
Dockimbel
30-Jan-2012
[4582x2]
Because, pointer [byte!] == c-string!
And because pointers on pointers are not allowed.
Oldes
30-Jan-2012
[4584]
How to define in RedS struct like:

typedef struct Info
{
  InfoType
    type;
  struct Info
    *next;
} Info;
Dockimbel
30-Jan-2012
[4585x3]
Struct aliases are there for that. See http://static.red-lang.org/red-system-specs.html#section-4.5.5
info!: alias struct! [
    type [...]
    next [info!]
]
Then you can just do for example:

s: declare info!
p: declare info!

s/next: p