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

World: r3wp

[Core] Discuss core issues

Henrik
20-Apr-2007
[7692]
also happens with empty strings
Gabriele
20-Apr-2007
[7693x2]
rebolek: i believe that is on rambo already. if not, feel free to 
add it.
oldes: i would guess that make block! n also clears the allocated 
memory, so it may be slower than a reallocation if you are using 
something like insert/dup etc. i think that when reallocating, the 
size is always doubled, up to a limit after which it is increased 
linearly.
Rebolek
20-Apr-2007
[7695]
Gabriele, you're right, it's there: Ticket #4162
Maxim
20-Apr-2007
[7696x2]
I have a deep question, when we use clear, does it clear the pre-allocated 
space (shrinking back a series) or does it only set the series termination 
to the specified index?
both are usefull, I just wonder which one is done internally?
Gregg
20-Apr-2007
[7698]
I believe it keeps the allocated space, so it's more efficient to 
reuse a series, rather than always starting a new one with copy.
Maxim
20-Apr-2007
[7699]
That's what I believe... I've just always had that tingling "What 
if"
Ladislav
20-Apr-2007
[7700]
Max: you can easily check:
>> a: make string! 1100
== ""
>> string-address? a
== 17267856
>> string-address? clear a
== 17267856
Maxim
20-Apr-2007
[7701]
string-address?  what is that?  Ladislav - you amaze me sometimes 
with your memory and knowledge of ALL rebol funcs... I never even 
saw thar arcane magic!
Gregg
20-Apr-2007
[7702]
I think it's based on his peek-addr stuff.
Maxim
20-Apr-2007
[7703]
oh, that is an internal ladislav mastery script
Ladislav
20-Apr-2007
[7704x2]
I mentioned the script recently on the ML: http://www.fm.tul.cz/~ladislav/rebol/peekpoke.r
(but it can be called arcane magic, I guess :-)
Maxim
20-Apr-2007
[7706]
;-)
Ladislav
20-Apr-2007
[7707x2]
>> a: "this is a string"
== "this is a string"
>> adr: string-address? a
== 17496432
>> len: length? a
== 16
>> clear a
== ""
>> as-string memory? adr len
== "^@his is a string"
;-)
Maxim
20-Apr-2007
[7709]
this is quite clean :-)  hum for debugging .
Ladislav
20-Apr-2007
[7710]
Anton used the same words, IIRC
xavier
22-Apr-2007
[7711]
very powerfull.  i learned something more today :)
Anton
23-Apr-2007
[7712]
Anyone remember the way to set all the fields of an object! to another, 
similar object! ?
I want to do this for font objects.
Sunanda
23-Apr-2007
[7713]
a: make object! [b: 445 c: 444]
 b: make object! [b: 999]
b: construct/with third a  b  ;; set b to a's values and fields
Anton
23-Apr-2007
[7714x6]
I have a further requirement; the object should be modified in place.
Let me get my example together:
f: make svv/vid-styles/text/font []
f2: make svv/vid-face/font []
Ok, so I want to modify F's fields so they are the same as F2's fields.
I think I found the way:
set f reduce bind copy next first f2 f2
Sunanda
23-Apr-2007
[7720]
You beat me to it with a better solution -- I was going to suggest 
a loop:
foreach v next first f [set in f v get in f2 v]
Anton
23-Apr-2007
[7721]
Yes, I was hoping for a bulk-set operation.
Gregg
23-Apr-2007
[7722]
Anton's version requires recent releases, where SET works on objects. 
Nice though!
Anton
23-Apr-2007
[7723]
That's ok, it's for the menu style I've been making, which already 
relies on several features added in recent times ... :)
Gregg
23-Apr-2007
[7724x2]
Could you just do: set f get f2?
Or do you need to rebind?
Anton
23-Apr-2007
[7726x2]
Excellent - that's what I was trying to remember.
( I think I only tried   set f f2  )
Seems to work the same.
Anton
27-Apr-2007
[7728]
Does anyone remember where we brainstormed that new SWITCH mezzanine, 
just before it became native ?
Chris
27-Apr-2007
[7729]
RAMBO, late last November.
Anton
27-Apr-2007
[7730]
Ah.. thanks!
Henrik
28-Apr-2007
[7731x2]
>> a: [1 2 3]
== [1 2 3]
>> b: a
== [1 2 3]
>> same? a b
== true
>> b: next b
== [2 3]
>> same? a b
== false


Is there a way to check that b is the same block as a, just at a 
different position?
>> same? head a head b
== true

I guess that is the solution
Anton
28-Apr-2007
[7733]
correct
btiffin
28-Apr-2007
[7734x2]
What is system/options/browser-type ?
What is system/options/browser-type  for?
Anton
28-Apr-2007
[7736]
I guess it is useful for the browser plugin.
btiffin
28-Apr-2007
[7737]
I'll buy that.
Maxim
29-Apr-2007
[7738x3]
yep... needed to switch DOM and the like  :-)
strange, I tried printing that path and in 2.7.2  it doesn't seem 
to exist... in what version did you try that?
btw... I assumed anton was confirming that the above path was usefull 
or part of plugin use... in that circumstance, the browser type would 
be usefull to know if the browser is mozzilla or IE based... but 
now... I'm a bit perplex!
btiffin
29-Apr-2007
[7741]
Maxim; REBOL/View 2.7.6.4.2  REBOL/Core 2.7.5.4.2 I just noticed 
it.  It's an integer! 0 in both.