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

World: r3wp

[Red] Red language group

Dockimbel
29-Mar-2011
[846]
none: I think Kaj has already defined it as null in his 0MQ wrapper. 
:-) So, I could add it in the common runtime file, it costs nothing 
(which is the least for none). :-)
Andreas
29-Mar-2011
[847]
Nope, struct has no initialiser.
Dockimbel
29-Mar-2011
[848]
STRUCT: it is a keyword, not a function. The memory space it takes 
is zero-filled.
BrianH
29-Mar-2011
[849]
I figured as much, since the type system would need this to be a 
keyword because the type returned is derived from the argument.
Andreas
29-Mar-2011
[850]
Hmm, that may be a stupid question, but: why not simply use a POINTER 
keyword similar to STRUCT for pointer declaration.
BrianH
29-Mar-2011
[851]
I was thinking that none could be a none! type, and then autoconvert 
to the particular reference type on assignment. Or it could be of 
type handle! in Red/System, with a predefined 0 value.
Dockimbel
29-Mar-2011
[852]
Andreas: could work and it  would be more consistent with struct. 
The other option is using & both for pointer and struct references.
BrianH
29-Mar-2011
[853]
Well, you don't really need a POINTER keyword if pointers are just 
syntactic sugar for struct references. Then & could be the keyword 
for both.
Andreas
29-Mar-2011
[854]
If you are happy with allowing address arithmetic on struct references, 
that's fine.
Dockimbel
29-Mar-2011
[855]
That sounds good. I need to take some time tomorrow to think about 
all that and see if there's no drawback hiding somewhere.
Andreas
29-Mar-2011
[856]
But I think struct padding requirements will kill address arithmetic 
on struct references for the general case.
BrianH
29-Mar-2011
[857]
Padding should be explicit in the struct declaration syntax, or default 
to no padding.
Andreas
29-Mar-2011
[858]
Padding is platform-specific.
BrianH
29-Mar-2011
[859]
Right. And language-specific and library-specific on any given platform. 
That is why it needs to have a good way to specify it.
Maxim
29-Mar-2011
[860]
wouldn't the arithmetic, just use the padding as part of the size?
BrianH
29-Mar-2011
[861]
That's why C compilers have pragmas for padding.
Andreas
29-Mar-2011
[862x2]
C is the target here.
For C and a given platform (and a given compiler, for some weird 
corner cases), default alignment/padding behaviour is specified.
BrianH
29-Mar-2011
[864]
Right. And since that changes from platform to platform and compiler 
to compiler we need a way to match those differences, with declarations 
or options or pragmas, same as the C compilers do.
Andreas
29-Mar-2011
[865x2]
The important issue is that the defaults match, if we want to have 
any.
Otherwise we can just drop the whole attempt at easier integration 
with C and go with a much more sensible storage layout dialect (think 
e.g. Erlang bitstrings).
BrianH
29-Mar-2011
[867x2]
Another important issue is that the defaults be settable on a per-platform 
or per-app basis, and that the behavior of Red/System is explicitly 
defined in a cross-platform way. We don't want to repeat the mistakes 
of C just because we're interfacing with C.
A lot of the stuff we have to integrate with will have C interfaces, 
but those interfaces will have struct layouts in them that were declared 
with precision for binary compatibility, using the pragmas and stuff 
that C was retrofitted with to allow such precision. We need those 
kinds of abilities from the beginning, or we'll have to retrofit 
it on later just like C did.
Andreas
29-Mar-2011
[869]
We'll probably still want to cater to the vast majority of C interfaces 
which just uses platform/compiler defaults.
BrianH
29-Mar-2011
[870]
Plus, struct references will be used to convert data to and from 
binary data read from files and network protocols, and those also 
need precise definitions.
Andreas
29-Mar-2011
[871]
I'd use a different and far more powerful dialect for that.
BrianH
29-Mar-2011
[872x2]
Right, we need settable defaults that can match the local C standard 
or whatever it is that sets the standard locally (JNI perhaps).
But if you don't have a way to specify the padding and maybe alignment, 
you won't be able to interface with C code that sets that stuff too.
Andreas
29-Mar-2011
[874x2]
One dialect for conveniently interfacing with C ("structs"), a different 
dialect ("records"?) for 100% precise control over bit layouts. Plus 
a way to convert between the two.
The former quite possibly replicating some C quirks, probably a few 
of the most important ones, as needed.
BrianH
29-Mar-2011
[876x2]
C structs are what I'm talking about, particularly ones declared 
with the pragmas. The quirks can go in the settable defaults, including 
things like the size of certain datatypes that have ill-specified 
types in the C standard.
You are a little spoiled on Unix-like platforms, Andreas. On Windows 
there is no standard C compiler; there are a bunch of competing ones 
instead. Each has its own quirks and defaults. Since Red is not itself 
written in C, you can't just go with the quirks of the same compiler 
it is written in. And different libraries are compiled by different 
people with different compilers. If you want to interface with them, 
you have to be specific.
Andreas
29-Mar-2011
[878]
I'm unfortunately more aware of this than I would like to be :)
BrianH
29-Mar-2011
[879]
It's worse for me usually, since most of the libraries I need to 
interface with are written in languages other than C (C++, Delphi, 
.NET, Java), or have to match precise binary interoperability standards 
(COM, etc.). Simple C compatibility would not work for me at all, 
and this has also been the case with R2's library interface. Fortunately 
the database access has made my SDK license worth it :)
Dockimbel
30-Mar-2011
[880]
Thanks guys for the insights and propositions. I found it a bit difficult 
to follow in realtime, I'm not sure that AltME is the best tool for 
such conversations. Maybe we should give a try to the Red web forum 
next time: http://groups.google.com/group/red-lang?
Reichart
30-Mar-2011
[881]
Nenad , how would reading something in a forum be better than reading 
it here?
Andreas
30-Mar-2011
[882]
Different mode of communication. Less "real-time", more asynchronism.
Dockimbel
30-Mar-2011
[883x3]
Well, usually, you have more time to read and reply on a web forum 
before the post you're referring to, gets lost in the flow of new 
ones.
AltME is nice, but sometimes, when users are posting too fast on 
deep topics, I have a hard time following the conversation. My english 
is not that good, so I have to check for some words exact spelling 
or meaning when reading/posting. Also, I like to take time to think 
about things before saying them, especially when the topic is deep/complex. 
The old REBOL ML was great for that. That's why I was proposing moving 
such conversations to Google groups, which is just a web front-end 
to a ML.
With mailing-lists, you can have a threaded view of conversations 
in your email client, so you can easily follow replies to differents 
posts. I usually have no issues following replies on AltME except 
when several users are talking together and posting replies fast, 
it becomes hard to follow in realtime.
Robert
30-Mar-2011
[886]
I miss the ML as well...
Dockimbel
30-Mar-2011
[887]
I guess that in AltME, if we could have a way to "mark" the post 
we're replying to when required, and the ability to switch to a "threaded" 
view, that would help a lot. In such "threaded" view, related posts 
could be grouped together with a [+] button somewhere allowing to 
unfold it and see all the replies to a given post. If posting while 
a thread is unfolded, the post would be considered a reply without 
having to "mark" the post related to the reply.
Robert
30-Mar-2011
[888]
yep
Gregg
30-Mar-2011
[889]
+1 Doc.
Mchean
30-Mar-2011
[890]
move it to groups and make it visible to the outside world
Rebolek
31-Mar-2011
[891]
Ok, I've got new error - "Bus error"
Dockimbel
31-Mar-2011
[892]
Error message is shorter than the previous one, I guess it is a good 
sign. ;-)
Rebolek
31-Mar-2011
[893]
Yes, I agree :)
Dockimbel
31-Mar-2011
[894]
If you need some external eyes to look at your code or test it (I 
can test on OS X), you can "gist" it  (https://gist.github.com/) 
and put the link here. I, Andreas, or someone else could have a look 
at it.
Kaj
31-Mar-2011
[895]
I'd guess a bus error is an invalid address