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

World: r3wp

[Red] Red language group

Dockimbel
23-Apr-2011
[1321x2]
Right, not yet. But the return type is checked when the function 
is used in an expression.
So, better get it right.
Kaj
23-Apr-2011
[1323x2]
That doesn't make it work, though
-= Red/System Compiler =- 
Compiling /users/administrator/Red/reply-server.reds ...
*** datatype not allowed
at:  [false]
>>
Dockimbel
23-Apr-2011
[1325]
Strange...will look into that in a few minutes.
Kaj
23-Apr-2011
[1326]
The difference may be between a variable and a constant
Dockimbel
23-Apr-2011
[1327]
Have you redefined 'false?
Kaj
23-Apr-2011
[1328x3]
No, I'm not that militant. :-) I do
;#define no			false
#define no			0
where false doesn't work
Dockimbel
23-Apr-2011
[1331]
I can't reproduce your issue here, can you give me a short example 
of a function making the compiler produce that error?
Kaj
23-Apr-2011
[1332x2]
It must be this one:
send: func [  ; Send message.
	socket		[pointer!]
	data		[pointer!]
	size		[integer!]
	flags		[integer!]
	return: 	[logic!]
;	/local		message [pointer!]
][
	either zero? as-message message data size none none [
		either zero? send-message socket message flags [
			zero? end-message message
		][
			end-message message
			no
		]
	][
		no
	]
]
Dockimbel
23-Apr-2011
[1334x2]
Ok, will try with a similar pattern of code.
Can't reproduce using:

bar: func [a [integer!] b [integer!] return: [logic!]][
	either zero? a [
		either zero? b [
			print "00"
		][
			print "11"
			false
		]
	][
		false
	]
]
either bar 1 1 [print "KO"][print "OK"]
either bar 0 1 [print "KO"][print "OK"]
Kaj
23-Apr-2011
[1336]
I'll try that
Dockimbel
23-Apr-2011
[1337]
This test code compiles and works OK.
Kaj
23-Apr-2011
[1338x2]
#define no			false
is what triggers it
Dockimbel
23-Apr-2011
[1340x4]
Ok, got it.
It is probably a 'false word reduction issue.
(in the preprocessor)
Kaj, I've just pushed a commit that should fix your issue.
Kaj
23-Apr-2011
[1344]
Thanks!
Kaj
24-Apr-2011
[1345]
The fix works; or at least it compiles now
Maxim
25-Apr-2011
[1346]
Doc, did you consider using the set-word!  type for getting pointers 
to words?  much like we use them to get function values, instead 
of calling functions...
PeterWood
25-Apr-2011
[1347x3]
http://groups.google.com/group/red-lang/browse_thread/thread/6a7438458d2d170b
I believe that the same "get-word" syntax will be used should  function 
pointers be  introduced at a later date
Though neither of these items are on the current to-do list.
BrianH
25-Apr-2011
[1350]
Maxim, that's the get-word! type. The set-word! type is used for 
assignment (setting).
Dockimbel
26-Apr-2011
[1351]
I have already added the support for getting function's address using 
get-word! syntax (it returns an integer! value). Structs, c-strings, 
pointer are already passed by reference.
Maxim
26-Apr-2011
[1352]
thx guys.
shadwolf
2-May-2011
[1353x2]
I'm a hudge militant of both the typed variable way (easy to interface 
C libraries) and the untype variable ( code more readable less maintenance 
etc...) This paradoxe tends to push me to imagine a world where the 
software will know what I need what ever the real sturcture behind 
is lets call it predictable type variable. How we do that ? I don't 
know but it seems fun enough to spend some brain cells  thinking 
of that. the idea is realy that interfacing external c/c++ java what 
ever library and maping it to the language innher variable and code 
will be absolutly transparent. (something like the .NET librabry 
browser but easier... Or more easyly we can have both system cohabiting 
side by side on the language schemes
though in rebol not having type for vars and () for function arg 
submition, make difficult to identify var content  distinguish var 
from function ... Maybe then  a syntaxique item like th e $ in php 
for vars or the @ in ruby for tables would be an interesting point... 
Sorry I try to think about rebol syntaxe structure like someone seing 
it for the first time
BrianH
2-May-2011
[1355]
Shad, typed variables with type inference handles the readability/maintenance 
problem pretty well, which is why several statically typed languages 
have been retrofiting type inference into them recently. Fortunately, 
Red is planned around that from the start.


Your "predictable type variable" proposal (I don't know the standard 
term either) sounds useful. Many languages do this through reflection 
facilities, but that kind of thing requires dynamically typed variables 
at least as an option if you are going to use the reflection facilities 
of the language you are interfacing with - this is necessary for 
C++ at least because there isn't a shared standard for encoding that 
information in a static way. It would be more useful for integrating 
with .NET or CORBA objects, since direct field access is prohibited 
anyways for those so there's no extra overhead in the field access 
itself, just in the runtime discovery, and ahead-of-time static compilation 
has shared rules that work on a binary standard.
Awi
2-May-2011
[1356]
Somebody created an open source .NET Micro Framework port to Arduino 
http://netduino.com/netduino/specs.htm. It's an ARM7 based microcontroller. 
Is it possible that someday Red would be available on this platform 
(Reduino sounds really good)? Just dreaming... How would I start, 
if I could help?
Dockimbel
3-May-2011
[1357]
Awi, that would be great, I would love to see Red run on such platform 
but I'm afraid Red's memory footprint would be a bit too high for 
a 60KB of RAM (but this might be specific to the netduino platform?). 
OTOH, Red/System compiler should work nicely there. If you want to 
help for such port, we need two things:


- a target file format emitter (I guess it would be the firmware 
file format)
- a native ARM7 code emitter as Red/System back-end. 


Let me know if you want to start working on these parts, I would 
provide additional documentations.
Awi
3-May-2011
[1358]
I think Red/System is already much better than .Net or C. I will 
look into both things you mentioned, but to be honest I have zero 
experience on porting. But let me see what I can do.
Dockimbel
8-May-2011
[1359]
I think I am going to port Red to this USB key size platform, once 
available: http://www.raspberrypi.org
onetom
8-May-2011
[1360]
nice machine... i would love to try
Kaj
8-May-2011
[1361]
Neat gadget, but Ubuntu is going to bog it down
Dockimbel
8-May-2011
[1362]
I would install a Damn Small distro instead.
onetom
8-May-2011
[1363]
doc: khm, u wanted to say syllable, right? ;)
Dockimbel
8-May-2011
[1364]
Sure! =)
Kaj
8-May-2011
[1365]
We'd have to port to ARM first
onetom
8-May-2011
[1366x2]
i was thinking about syllable server. what has to be ported on it 
to arm? if u ubuntu runs on this thing, then the kernel and c compiler 
shouldnt be an issue
no altme though... i can't use it as my development machine then 
;D
Kaj
8-May-2011
[1368x3]
We've had a pattern of people who came to our mailing list shouting 
enthusiastically that they had found out that the "GNU C compiler" 
would compile to PowerPC or something, that they would compile Syllable 
to it over the weekend and report afterwards
We never heard from such people again
Sure most parts of Syllable Server have been ported to ARM in other 
projects, but porting the system will be many man months of work 
at best