World: r3wp
[Core] Discuss core issues
older newer | first last |
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 [13130x3] | 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. | |
using rebol to peek inside of rebol isn't disassembling :-) | |
Steeve 24-Mar-2009 [13133] | There some differences between us Doc, you have a company selling rebol services ans progs. Me, I don't use Rebol professionaly |
Dockimbel 24-Mar-2009 [13134] | Well, only RT knows for sure how it works internally, if some info is disclosed, then it become public so no problem talking about it, I think. |
Steeve 24-Mar-2009 [13135] | So, even if you had disassembly rebol, you can't say that |
Dockimbel 24-Mar-2009 [13136x2] | Whatever way you use REBOL (hobby or professionnal use), it implies accepting the EULA. |
By installing or using the SOFTWARE, you are consenting to be bound by and are becoming a party to this AGREEMENT. If you do not agree to all of the terms of this AGREEMENT, do not use the SOFTWARE. | |
Steeve 24-Mar-2009 [13138] | You're such a boring guy Doc, i didn't know you were |
Dockimbel 24-Mar-2009 [13139] | I'm a guy with principles and respecting the work done by other is one of them. I like playing by the rules. |
Steeve 24-Mar-2009 [13140] | Ok we know now, don't push yourself |
Oldes 24-Mar-2009 [13141x3] | As I'm reviewing my old code, where I see a lot of rejoins where the first arg of block is always binary... what do you think about something like: abin: func[block][append copy first block next block] where the speed gain is: >> tm 1000000 [abin [#{00} "a"]] 0:00:01.609 >> tm 1000000 [rejoin [#{00} "a"]] 0:00:02.938 |
maybe not such a big gain.. as I must use: abin: func[block][append copy first block reduce next block] which has result 0:00:02.078... but anyway.. every ms counts:) | |
mazbe it's strange that works: >> make string! reduce ["a" "b"] == "ab" but not: >> to binary! reduce [#{00} "a"] ** Script Error: Invalid argument: #{00} ** Near: to binary! reduce [#{00} "a"] | |
[unknown: 5] 24-Mar-2009 [13144] | abin: func[blk][head insert tail blk/1 blk/2] |
Oldes 24-Mar-2009 [13145] | abin: func[ "faster binary creation of a block where the first arg is already binary!" block ][ head insert tail copy first block: reduce block next block ] ;to be able have code like: abin [to-binary #"^(00)" "a" "b"] |
BrianH 24-Mar-2009 [13146x5] | I didn't decompile or disassemble, I just used the scientific method to evaluate behavior. |
Same way I came up with the initial documentation about REBOL contexts and binding back in 2000. | |
Everything else is based on public discussions in various chat groups. | |
Oldes, a faster way (in R2) is this: abin: func[ "faster binary creation of a block where the first arg is already binary!" block ][ head insert copy #{} reduce block ] | |
Of course the doc string would need to be changed, because there would be no restriction on the type of the first expression. | |
older newer | first last |