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

World: r4wp

[#Red] Red language group

DocKimbel
7-Dec-2012
[4586]
Pekr: I guess the question is "why not i: #FFFFFFFF?"? Simply because 
# denotes an issue! value not an integer!. The hexadecimal format 
ending with an `h` character gets converted to an integer! value 
during the LOAD phase. If you have a better proposition for hexadecimal 
literal value, I would be glad to hear it.
Pekr
7-Dec-2012
[4587]
yes, FFFFFFFF# :-)
DocKimbel
7-Dec-2012
[4588x4]
From the Unity link: "Most of these are virtual machines running 
Windows, Mac OS X, and Linux." 


I though Apple was explicitly forbidding to install Mac OS X on anything 
other than Apple hardware? Do they sell special licenses for VM?
Ah, missed that part: "...using a combination of Apple and non-Apple 
hardware."
Kaj: I've fixed the extra struct warnings.
Pekr: your proposition is not as bad as it could be at first look. 
;-) 


REBOL allows to prefix binary values with a base integer, with base 
16 as default::

    #{F0}
    16#{F0}
    2#{1111111100000000}
    64#{8A==}


We could use a similar convention, but as a suffix, for specifying 
the base for an integer! value:

    123
     7B# 	(default base would be 16 too)
     7B#16
     01111011#2
     173#8


Such literal forms with base explicitly specified would be converted 
to integer! decimal form at LOADing stage. This is just me thinking 
loud, but how does that look like to you?
Henrik
7-Dec-2012
[4592]
If the REBOL format works, why is there a need to change it?
DocKimbel
7-Dec-2012
[4593x2]
Binary! <> integer!
It is not a change, it's an addition.
Henrik
7-Dec-2012
[4595]
ok, why is the new method useful?
DocKimbel
7-Dec-2012
[4596]
Specify literal integer values in base: 2, 8 or 16.
Henrik
7-Dec-2012
[4597]
Why can you not use the original datatype for this?
DocKimbel
7-Dec-2012
[4598x2]
So instead of the very costly:
    a: to-integer #{FFFF}
you could write it:
    a: FFFF#
Binary! is a series datatype, integer! is a scalar datatype, they 
are fundamentally different.
Henrik
7-Dec-2012
[4600]
ok, now I understand.
NatasjaK
7-Dec-2012
[4601]
DocKimbel: Kaj told me about you going to Peking for 3 months the 
upcoming year. Congrats. I Hope they are willing to invest.
DocKimbel
7-Dec-2012
[4602]
Thanks, I need first to get a Visa, so it is not done yet.
Pekr
7-Dec-2012
[4603x3]
Doc, I like the proposition, although I can understand, that some 
ppl might find FFFFFFh cleaner, cause e.g. FF#16 looks a bit heavy 
:-) OTOH - if someone writes just ffffffh, it is really difficult 
to read. So in general, I like your proposition :-)
I am not good at that stuff, but what about 0xFFFFFF, isn't something 
like that in C?
Doc - you are going to spend 3 months in Peking, so no Red advancements 
in that period? In such a case, I hope you bring some money to the 
Red homeland :-)
DocKimbel
7-Dec-2012
[4606x2]
Lowercase letters are not allowed in hexadecimal literals (both in 
Red and Red/System), so ffffffffh is not a valid syntax. 0x prefix 
is colliding with pair! syntax, so you can't tell if, e.g., 0x13 
is a pair! or an hex literal.
I am going to spend 3 months at least in Peking for working on Red, 
but not only on the coding part. I will try to setup a business activity 
around Red in order to fund its development further. I prefer to 
not talk much publicly about it for now, as I am not yet there and 
there are some potential NDA clauses that I would like to avoid having 
issues with. ;-)
Pekr
7-Dec-2012
[4608x2]
OK, I just hope that some Chinese investor isn't going to request 
you to close source Red in order to become their national selected 
language of choice :-)
Some nice business oportunities are really welcomed. There are some 
fine mobile players in China - ZTE, Huawei, maybe even HTC? HTC could 
buy Amiga name, I alrady suggested it to them :-) Then all dots connect 
and then they will bring Carl, to work ... on Red  :-)
DocKimbel
7-Dec-2012
[4610]
Closed-source: I guess we are now all well-aware how disastrous it 
can be. Open-source is a superior way of building good and long-lasting 
software, even investors can understand that. :-)
Steeve
7-Dec-2012
[4611]
Be careful Doc, You may bring back not only chinese investors but 
also some pretty girls
Pekr
7-Dec-2012
[4612]
:-D
DocKimbel
7-Dec-2012
[4613]
Steeve: pretty girls are not restricted to China. :-)
Steeve
7-Dec-2012
[4614x2]
Still, one know guys who have gone to distant Asia as single and 
came back married.
It's a well known trap ;-)
Kaj
7-Dec-2012
[4616x2]
Yeah, almost all my cousins
I like the # suffix proposal. It stands out better than the h suffix 
and looks more in line with REBOL
Steeve
7-Dec-2012
[4618x2]
Arghhh! My first time compiling something to Red:
-= Red Compiler =-
Compiling red/tests/sorting.red ...
*** Red Compiler Internal Error: Script Error : copy expected ran
ge argument of type: number series port pair
*** Where: process
*** Near:  [stack/push to type copy/part s]
I ran %run-all at first and it was alright
DocKimbel
7-Dec-2012
[4620x3]
Looks like an issue with the changes I did for ticket https://github.com/dockimbel/Red/issues/319
You can try to compile it with -v 9 option to better locate the line 
that trigger the error.
Could you post your script there if short enough (else just post 
it to me privately or on the bugtracker)?
Steeve
7-Dec-2012
[4623]
Actually I know there are errors in the script since I did not try 
to translate it from R3 to Red. But I was expecting something else 
for a starter
DocKimbel
7-Dec-2012
[4624x2]
It would be nice if we could fix that compilation bug before the 
new release.
Hmm, sorry it is not related to #319, it looks more like a lexer 
issue. You are probably passing a datatype that is not yet implemented 
in Red.
Steeve
7-Dec-2012
[4626x2]
I cut my script and got the same error with just the following:

Red []
;*** Bottom-up-heapsort ***
heapify: func [s start len comp /local step sav inc][
	inc: 0
	sav: s/:start
	;-- search terminal leaf.
	step: start
	while [len > step: 2 * step][
		++ inc
		unless comp s/(++ step) s/:step [-- step]
	]
	either step = len [++ inc][step: shift step -1]
	;-- bottom-up, search insertion point
	loop inc [
		unless comp s/:step sav [break]
		step: shift step -1
		-- inc
	]
	;-- bottom-up swap
	loop inc [						;-- chain swap
			s/:step: also sav sav: s/:step
			step: shift step -1
	]
	s/:step: sav
]
I have not tried to translate anything... T_T
DocKimbel
7-Dec-2012
[4628x3]
The lexer is choking on get-word used in path...let me see that...
Actually, it's blocking on s/(++ step), such syntax should be supported 
by the lexer, so there's a bug there.
Steeve: I have fixed the lexer bug, so it should at least load correctly 
now. But paren! in path are not yet compiled, so you'll get a "feature 
not implemented" at compilation.


Also, passing a function as argument is not yet correctly handled. 
Also I'm unsure if s/:step: will be compiled correctly, as we haven't 
yet much tests for path accesses.
Kaj
7-Dec-2012
[4631]
All examples compile without warnings now
DocKimbel
7-Dec-2012
[4632x2]
Thanks!
(for testing)
Gregg
7-Dec-2012
[4634]
For hex notation in REBOL, I've used (albeit dynamically) a simple 
HEX function with issues. 

  hex #20000001


I'm OK with the suffix approach, but if a prefix approach works I 
like that the prefix clues you in to what you're reading, rather 
than reading the number and then seeing the suffix. The question 
is what sigil to use, if lexical space becomes very tight, as in 
REBOL. Do you have any plans for &?

  &HFFFF000F
  &O77770007  ; though I don't think we need octal
  &B11110001
Maxim
7-Dec-2012
[4635]
the following are currently invalid REBOL notations (the first three 
load in R2 but get scrambled)

I prefer the first tree, since they are pretty obvious without any 
knowledge of the language.

16#FFFF000F
8#7124554764
2#0110110101

H#FFFF000F
O#7124554764
B#0110110101