• Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r4wp

[#Red] Red language group

Rebolek
21-Mar-2013
[6401]
@DocKimbel: Thanks, I have a look at it. I'm not bit stalled with 
implementation of INPUT function, I'm not sure how to delay evaluation 
until ENTER is pressed.
DocKimbel
21-Mar-2013
[6402x2]
Jerry: no, these are not yet supported. You can see what is missing 
for full floats support here: 


https://github.com/dockimbel/Red/wiki/Floating-point-support-todo-list
6. Decide on how to handle NaN and INFs.


I haven't looked at how R3 handles them yet, IIRC, R2 doesn't provide 
any support for them?
Endo
21-Mar-2013
[6404x2]
New console is great!
1) Q is not QUIT anymore?
2) red>> EXIT
== c
DocKimbel
21-Mar-2013
[6406x3]
I've remove Q, use QUI.
Sorry, QUIT.
EXIT/RETURN do not work in the interpreter yet.
Kaj
21-Mar-2013
[6409x2]
Rebolek, if you mean INPUT in Red, it's implemented in the C library 
binding:
http://red.esperconsultancy.nl/Red-C-library/dir?ci=tip
Arnold
21-Mar-2013
[6411x3]
Thanks for removing q alias of quit !!! Thank you thank you thank 
you!!!!
Really top move! (really!)
R3 should follow this. So many time you want to use short temp var 
p and q and then it all just quit on you :(
Henrik
21-Mar-2013
[6414]
Curious. I never found that to be a problem and use q for quit many 
times a day. I hope 'q can be chosen freely.
Arnold
21-Mar-2013
[6415]
More than once the console quit on me when I wanted to use q.
DocKimbel
21-Mar-2013
[6416x2]
Henrik: you'll be able to add your own definitions in a %user.red 
script when the time comes.
If there is any last minute bug, it is now time to speak, else the 
fix won't be in 0.3.2 release. If we are ready I'll make the release 
in a couple of hours.
Henrik
21-Mar-2013
[6418]
DocKimbel, ok, that's fine. :-)
Jerry
21-Mar-2013
[6419]
Gonna write a short blog article for 0.3.2?
DocKimbel
21-Mar-2013
[6420]
As usual, yes.
Arnold
21-Mar-2013
[6421]
Last minute bugs are usually marked as features.
Pekr
21-Mar-2013
[6422]
I want both - Q and QUIT :-)
DocKimbel
21-Mar-2013
[6423]
Q is ok for console, but it's a bad idea to have it defined generally. 
Such shortcut should go in a console specific module.
Henrik
21-Mar-2013
[6424]
Agree.
Gregg
21-Mar-2013
[6425]
Doc +1.
DocKimbel
21-Mar-2013
[6426]
I've removed Q from the console-specific module thinking it was in 
boot.red. :-) Needs some rest.... I will put Q back in console.red. 


Sorry Arnold. BTW, how do you manage to call quit the console if 
you redefine Q for custom usage?
Kaj
21-Mar-2013
[6427x2]
Using before defining, I gather
Those repeated shocks to the brain are very helpful to learn REBOL's 
principles ;-)
DocKimbel
21-Mar-2013
[6429x2]
Arnold: if you have such issues with Q in console, you should simply 
set it to none in %user.r for Rebol. For Red, you would need to change 
the console.red script and recompile it for your needs.
Ok, one last possible bug to investigate in GTK-IDE script and we 
should be ready to release.
Endo
22-Mar-2013
[6431]
I use 'q A LOT on R2 console. In scripts no need that shortcut but 
on console it is a MUST for me :) I open/close R2 console every 30 
seconds to do something like english-turkish translation, to see 
NOW, to use functions manipulating clipboard etc. then Q-it..
Arnold
22-Mar-2013
[6432]
Hi do not recall it exactly but I think it was when I was developing 
the checkersgame program and somehow I had a variable q and when 
the code was executed the program and the console closed forcing 
me to restart REBOL.  

The solution you have chosen now will pretty wel have prevented this 
behaviour, still offering a shorthand for quit in console mode is 
welcomed by many. Good thinking again!
Oldes
22-Mar-2013
[6433]
Just playing for a while after some time.. What steps are required 
to add a new native!? I was trying to duplicate stats native as is 
in this commit, but maybe it's not complete as now the console quits 
immediately.

https://github.com/dockimbel/Red/commit/1836a0cd04f703bdd28bfb177e99c317340be5d1
DocKimbel
22-Mar-2013
[6434x2]
I plan to write an HOW-TO guide for that someday, but in the meantime 
and in a nutshell, this is what is required:

1) NAT_<name> enum entry in %macros.reds (order matters!)


2) pointer entry in REGISTER argument block (same order as in macros) 
in %natives.reds


3) an entry point implementation in %natives.reds (if the code is 
too big you can move it elsewhere as long as the entry point is in 
natives.
Of course, you'll need to use the internal Red runtime API and stack. 
No docs for now, as it is not stabilized fully, but you can guess 
a lot of it from other natives and actions implementation.
Oldes
22-Mar-2013
[6436x4]
hmm.. that's what I was doing.. but have:
*** Runtime Error 1: access violation
*** at: 004188CEh
In boot.red
foo: make native! [
	[]
	#get-definition NAT_FOO
]
in natives
foo*: does [halt]
and registered as :foo*

in macros enum added NAT_FOO
when I change #get-definition NAT_FOO  --> #get-definition NAT_HALT 
=== it's working again
Ach... it looks there is some confilct with the name FOO for my native
DocKimbel
22-Mar-2013
[6440]
Tested here, works well.
Oldes
22-Mar-2013
[6441x2]
hm.. now it works here as well even with the name foo... maybe I 
just fooled the compiler as I compile from REBOL console using:

do/args %red.r "-v 0 %red/tests/console.red -o %../builds/console"

so possibly if there was some error before, the compiler state was 
not cleared
so now I have my first native which halts console:)
DocKimbel
22-Mar-2013
[6443x2]
That's possible, the %boot.red extraction routine do not refresh 
their data structures IIRC.
BTW, you can add also new natives using the routine! type. Routine 
body are coded in Red/System too, so they are equally efficient as 
natives. Routines are easier to define (no need to mess around with 
runtime internals). Their only drawback so far is that they don't 
support refinements (we might add that later).
Oldes
22-Mar-2013
[6445]
I would like to access stdout, is it possible from routine?
DocKimbel
22-Mar-2013
[6446]
Sure, use one of Red/System output function: print, print-line, print-wide...
Gregg
22-Mar-2013
[6447]
Congratulations Oldes!
DocKimbel
22-Mar-2013
[6448]
Routine == Red/System + automatic argument/return-value marshalling.
Pekr
22-Mar-2013
[6449]
Refinements would come in handy at some point in future, no?
Oldes
22-Mar-2013
[6450]
What if I want native, which takes one integer! argument? stack/arguments 
seems to return pointer