World: r4wp
[#Red] Red language group
older newer | first last |
Kaj 19-Oct-2012 [2910] | I think you don't want to understand me, but my time is up |
BrianH 19-Oct-2012 [2911] | Btw, you can't run applications for Linux on Unix without a compatibility library either. Bringing MS into it is just an insult. |
Kaj 19-Oct-2012 [2912] | Ah, see, you do understand me :-) |
BrianH 19-Oct-2012 [2913] | I don't expect Red and R3 to have the same system model, because if they did there would be no point to having Red at all. Being able to have extensions that can integrate into both would be an unusually amazing bonus :) |
Kaj 19-Oct-2012 [2914] | I still don't know if you really don't see it, but I could easily define them |
BrianH 19-Oct-2012 [2915x2] | For that matter, I expect to make my own Rebol spinoff language that will follow a completely different system model than either Red or Rebol, and the only reason to do so is because those other languages don't cover that situation (otherwise I would have been more active in Red so far). Being different justifies their existence; interoperating with each other justifies their cooperation :) |
I don't expect Red and R3 to be compatible because Red is compiled and R3 is interpreted. Both models have their place and their strengths. That doesn't mean that they can't be compatible with each other where that makes sense, or interoperate with each other where that makes sense. | |
DocKimbel 20-Oct-2012 [2917] | I don't expect Red and R3 to be compatible because Red is compiled and R3 is interpreted. I hope you like surprizes then. ;-) |
BrianH 20-Oct-2012 [2918x4] | I don't expect it, but that doesn't mean that we won't do our best to fake it :) |
Are you planning to use the direct binding model, and value slots? | |
Out of curiosity... | |
Assuming that Red will be compiled (even JIT), the actual semantics will be different even if the outside behavior will appear to be similar enough that it won't matter for most people, hence the "fake it" phrase. It would be a disservice to us if we got a compiler, which has definite if minimal disadvantges over an interpreter, without getting the advantages of a compiler such as a practical optimizer. The behavior of R3 and Red could be quite similar to an outside observer that doesn't look closely, but they would require different optimization strategies to get the most efficient code. In that way I don't expect them to be compatible - they would likely be even less compatible than R2 and R3. But that's not really a problem :) | |
DocKimbel 20-Oct-2012 [2922x2] | Are you planning to use the direct binding model, and value slots? That's already there in Red runtime. |
Red runtime library | |
BrianH 20-Oct-2012 [2924] | Sorry for the dumb questions, I've been too busy to participate yet :( |
DocKimbel 20-Oct-2012 [2925] | Semantics will be very close, probably 99% close, as I've moved from a statically typed system to an hybrid static/dynamic typing system. |
BrianH 20-Oct-2012 [2926] | So, no lexical binding? Or do you plan to infer lexical binding where possible, and use direct where not? |
DocKimbel 20-Oct-2012 [2927x3] | So, if all goes well, you'll have the full REBOL model + optimizations. There are many ways to optimize and on many different abstraction levels. Yet, some atomic operations will remain "unoptimized", like series atomic manipulations (maybe we'll figure out a way to optimize them too in the future). |
Lexical binding will be added when we'll add contexts (in a few weeks), along with dynamic binding (yes, you'll be able to have fun with BIND again ;-)). | |
In a couple of days, I'll release the first Red alpha with a blog entry to describe it, you'll be able to get a better picture of what's in Red already and where it's heading. | |
BrianH 20-Oct-2012 [2930x2] | So, my module system will end up being of more use to you. I'll be sure to write up that TRANSCODE/part option request for R3 in CureCode, for your reference. |
I ran into the need for that with multi-scripts. | |
DocKimbel 20-Oct-2012 [2932x2] | Well, maybe. :-) I must admit I haven't yet dived into R3 module system to see if it fits well our needs. |
our needs : they are not yet clearly defined, btw. | |
BrianH 20-Oct-2012 [2934] | It isn't specifically for R3. Most of the design decisions were based around the constraints of the direct binding model, and of making it as simple as possible for people who are not used to modular programming to use. Beyond that, we just made it as powerful as possible without killing the usability. |
DocKimbel 20-Oct-2012 [2935] | Being simple is probably the most important feature I would require from a module system. |
BrianH 20-Oct-2012 [2936x2] | There are still some parts that I could use a little help with though, like resolving import cycles. And there are some bugs and/or weaknesses in the native code that I've had to work around in my patches collection. |
The "being simple" part was mostly driven by Carl. I tried to make it simple, but it took some doing to make it even more simple for Carl. There's a lot of subtle code in there to make it simple enough for Carl to want to use it. | |
DocKimbel 20-Oct-2012 [2938] | Resolving import cycles : we've solved that in Red/System compiler by having a simple "included files" list and it stops inclusion if already done once. But we do that at compile-time, so it's easy. |
BrianH 20-Oct-2012 [2939x3] | I thought that something similar would work for R3, but haven't done it yet. R3 releases kind-of stopped before I got the chance. |
A module system is where you would find a lot of places where the internals would be different, due to the compilation thing, but the external behavior could appear to be the same. There are a lot of nice tricks in R3's module system, and I've gone through a lot of trouble to make it possible to have the module system be handled by a preprocessor that doesn't have to execute any of the code in the modukle bodies to resolve dependencies. It was designed with preprocessors like prebol or Ladislav's include in mind. And all of that is in the specifications of how modules are declared, not in the actual mechanism that implements it, so the concepts would be portable to Red. | |
There's no reason that Red couldn't also implement compressed scripts, checksums, multi-scripts and embedded scripts the same way too. All of those apply to all scripts, not just modules, so they could work the same way for runtime-compiled Red scripts as well. | |
DocKimbel 20-Oct-2012 [2942] | Certainly, but AOT compilation would be a big plus. Also, in Red we need to modularize the compilation process itself, so we can do incremental AOT compilation on multi-files projects instead of having to rebuild everything (include runtime libraries) each time. We need to, somehow, match those compilation units with the higher-level module system (it's not the only option, but probably the most simple). |
BrianH 20-Oct-2012 [2943x8] | Multi-scripts would be mostly a packaging method. It could even help AOT compiled scripts at the script distribution phase. I'm thinking of install-time-compiled scripts, for instance. It would also help with mixed-Rebol-Red projects like what I described above for R3 extensions. Also, it could help for data files in some cases, or metadata embedded in other files. |
Well, the R3 module system is designed to be statically resolvable, so the same method would work for resolving Red modules in a project. | |
That is why Needs and Exports are headers rather than function calls, and export and hidden are module-code-block keywords instead of functions. You can determine the whole dependency chain by loading the script, examining the header, and searching the top block of the source for the keywords. | |
The same goes for extensions - their embedded module wrapper is treated like any other module. You could AOT compile R3 extension wrappers that dynamically load the extension's native code at runtime. | |
Here are block-embedded multi-scripts: [rebol [] print "hello world"] [red [] print "hello world"] | |
Here are length-specified multi-scripts (which can be faster at times): rebol [length: 19] print "hello world" red [length: 19] print "hello world" | |
Note that if you specify the length, it applies to the length of the script after the header and an optional newline after it (cr, crlf or lf). Same goes for the checksum. Both apply to binary data, meaning the source in UTF-8 encoding and with newlines in the style that they are specified in the file. | |
With compressed scripts, you can either have raw compressed data, or binary! syntax compressed data, after the header and an optional trailing newline. If you have raw binary data and a length header then it is only decompressed until the end of the length (with DECOMPRESS/part). The option of binary! syntax is useful for block-embedded scripts or scripts posted in a text environment, and it doesn't really combine well with the length header so that is ignored in this case; one of them had to take precedence (until I get TRANSCODE/part) so I picked compression. It is more likely that the length header and raw compressed data would be combined, anyways, For compressed scripts, the checksum applies to the decompressed binary data. | |
DocKimbel 20-Oct-2012 [2951] | install-time-compiled scripts We'll support that option too. Statically resolvable module system: that's a very useful feature to have, not only for compilation, but for auto-documentation generation too. |
BrianH 20-Oct-2012 [2952x2] | The same method that is used for compressed scripts could be used for encrypted scripts too, or for precompiled modules that you are packaging together. The same method used for checksums could be used for cryptographic signatures as well. |
This also lets you store scripts or modules in databases too. | |
DocKimbel 20-Oct-2012 [2954x2] | You should take upcoming red|rebin format also into account. That might be a preferable method sometimes rather than compressed scripts. Red will pre-compile most of the scripts content, but we might keep some "code" blocks in source form for reflection (when used by the script and inferred by the compiler). |
I wanted to publish my redbin specs earlier, but stopped when I read that R3 might use a copyleft license. | |
BrianH 20-Oct-2012 [2956] | The community is leaning more towards Apache now, so as long as you don't patent redbin (or grant use of the patent) it would be usable. |
DocKimbel 20-Oct-2012 [2957] | An asymetric permissive licensing model between Red and R3 might prevent me from publishing info about what we'll do next, to prevent the features from being implemented first with a copyleft license attached. It would just be unfair to Red, so I would have to be cautious about that. |
BrianH 20-Oct-2012 [2958] | Don't underestimate the value of treating the header and the rest of the script differently. It lets you put a lot of static information in the header without even looking in the sctipt data at all. |
DocKimbel 20-Oct-2012 [2959] | Right, the header is a great source of metadata. |
older newer | first last |