World: r3wp
[Core] Discuss core issues
older newer | first last |
Maxim 24-Mar-2009 [13082] | there is no other way... you have to know the bounds, and allow ram to be recycled. indirection is the only way to do this. rebol has its own memory manager. |
Steeve 24-Mar-2009 [13083] | but new references on the same serie only consume a new slot of 16 bytes |
[unknown: 5] 24-Mar-2009 [13084x2] | Maxim, there are other ways. |
Maybe not in REBOL but there are in other languages for example. | |
Maxim 24-Mar-2009 [13086x3] | other languages do not use mutable series. they use immutable strings within a single index. every operation is a memcopy and then replace the pointer. |
and all references to a string are actually independant... change the string in varA and varB doesn't reflect it. | |
in rebol, they really are the same actuall string object. | |
[unknown: 5] 24-Mar-2009 [13089] | I'll have to learn more about mutable series verse immutable series. |
Maxim 24-Mar-2009 [13090x2] | python string objects, are comparable to rebol's series, but use immutable string internally, to be compatible with C. |
mutables actually make rebol harder to interface to most external code, cause we don't use the normal string end concept of terminating with a 0 char. | |
[unknown: 5] 24-Mar-2009 [13092] | So what do you mean when you say "mutable"? |
Maxim 24-Mar-2009 [13093] | rebol changes the actual bytes within the ram. most languages, create new strings and assign the new pointer to the variable. |
[unknown: 5] 24-Mar-2009 [13094] | Ok, so that means mutable? |
Maxim 24-Mar-2009 [13095] | yep... the ram mutates, "in-place". |
[unknown: 5] 24-Mar-2009 [13096] | Got ya. That is easy enough to understand. |
Henrik 24-Mar-2009 [13097] | wasn't that also the difference between R1 and R2? |
[unknown: 5] 24-Mar-2009 [13098] | But if that is the case then if the string changes such that it doesn't fit the size of the existing allocation , then what happens? |
Maxim 24-Mar-2009 [13099] | then rebol reallocates a new region of ram and copies the current data into it, adding a few extra bytes based on heuristics, so that small changes don't need to constantly re-allocate ram. |
[unknown: 5] 24-Mar-2009 [13100] | So do you believe that REBOL is using the Pascal like length-prefixed strings? |
Maxim 24-Mar-2009 [13101] | which is why you should do : s: make string! 10003 when you know that your algorythm will eventually reach 10000 bytes |
[unknown: 5] 24-Mar-2009 [13102] | Correct, that is how I see it and why I ask about this. Because to me this makes more sense as to assigning the length before hand. |
Maxim 24-Mar-2009 [13103x3] | no since strings are objects, just like all datatypes. they have internal counters for offset, length, etc. the string itself really is just a buffer. which is why in R2 strings and binary really are the same thing. in R3 this is quite different. |
the binary and character lengths of strings aren't the same thing, depending on the encoding of strings. | |
(in R3) | |
Steeve 24-Mar-2009 [13106x2] | it's why as-binary or as-string can't be no more exisit in R3 |
in R2, it's really fast because only the type of the value is changed (no boring things like copy are done) | |
[unknown: 5] 24-Mar-2009 [13108x6] | See, I see strings stored in memory as nothing more than a character array. |
The actual data part rather. | |
HLA is a language that stores string data a bit differently it sounds. It allows both null termination but allows null use in string also. | |
It got me thinking as to how REBOL does its length handling. | |
In HLA, the string is prefixed with a dword value indicating max-length, then a dword value indicating current length, then the string characters and then a null termination. | |
So it is 4 parts to a string. | |
Dockimbel 24-Mar-2009 [13114] | >> license ... The copyright, trademark, and other proprietary rights notices contained in the SOFTWARE may not be removed, altered, or added to in any way. You may not reverse engineer, decompile, or disassemble the SOFTWARE. ... |
Steeve 24-Mar-2009 [13115] | ... |
Dockimbel 24-Mar-2009 [13116] | Seems that some here broke the REBOL EULA. |
[unknown: 5] 24-Mar-2009 [13117] | I would think we are guessing if anything Doc. |
Steeve 24-Mar-2009 [13118] | educationnal purpose |
[unknown: 5] 24-Mar-2009 [13119] | Oh you must be referring to those that dissassembled. Shame on you Steeve and Brian. ;-) |
Steeve 24-Mar-2009 [13120] | i'm under Europe laws here |
Maxim 24-Mar-2009 [13121] | was funny when Ladislav explained his mem manipulation things to Carl. ;-) Carl was impressed more than anything hehehe |
Dockimbel 24-Mar-2009 [13122] | There's no such exception in the EULA. The EULA is a contract between the end user and the publisher. AFAIK, EULA applies in EU too. |
Steeve 24-Mar-2009 [13123] | Much of my comments are just guessing, mister cop :-) |
[unknown: 5] 24-Mar-2009 [13124] | Doc have you ever disassembled REBOL? |
Dockimbel 24-Mar-2009 [13125x2] | I don't want to defend RT here, just reminding some of you that using REBOL implies agreeing the EULA. Not that I fully agree with RT ways of distributing REBOL, but this is an official REBOL channel that's [web-public], so at least we should respect the EULA. |
Paul : never and I never plan to do so. | |
[unknown: 5] 24-Mar-2009 [13127x2] | Excellent Doc! |
Good point also about it being web-public. | |
Dockimbel 24-Mar-2009 [13129] | As you state above, guessing how some parts of REBOL work internally can be done without breaking the EULA. |
Maxim 24-Mar-2009 [13130x2] | Doc, knowing how rebol works internally isn't guess work and disassembling. |
some of this comes from RT itself, and even from such things as playing around with structs. | |
older newer | first last |