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

World: r3wp

[Core] Discuss core issues

Maxim
30-Sep-2010
[18531]
when we generate blocks on the fly, we sometimes need evaluation 
to occur at a later stage.  this allows to save on an uneeded additional 
copy.  (which can be taxing on the GC when blocks are large)
Ladislav
1-Oct-2010
[18532]
this allows to save on an uneeded additional copy.
 - if you are referring to the

    reduce/into b b


expression, Max, then your assumption is wrong, this cannot save 
an unneeded additonal copy
Maxim
1-Oct-2010
[18533]
well IIRC Steeve had done tests and it was much faster... so something 
is being saved.
Izkata
1-Oct-2010
[18534]
it was so that new memory didn't need to be allocated in this expression, 
and the old didn't need to be garbage collected:

b: reduce b
Steeve
1-Oct-2010
[18535x3]
About the /into refinement.

I don't bother if internaly, a copy is done or not, while it's faster 
and memory safe (the block must be freed immediatly not by the GC) 

The GC used to have some memory leaks and was reacting too late to 
be useful (especialy in apps with a GUI).
I now it's better now (thanks to recycle/ballast).
* I know
about reduce/into b b

It allows to keep several references of the same block without the 
need to reassign them when the block is reconstructed.

But currently, we can't avoid the block expansion because the data 
are inserted instead of beeing replaced (which would be more useful 
to my mind).

Then, if internaly it's faster to do a copy, I don't care while it's 
not recycled by the GC (for the reasons I mentioned previously).
BrianH
1-Oct-2010
[18538x2]
Sounds interesting. I know that CHANGE/part is the real fundamental 
operation, but that needs an additional parameter and would require 
renaming the option - /into isn't an appropriate name for that operation. 
But I don't think it would have been implemented in that case, and 
having it be a direct CHANGE would definitely not have been accepted 
because /into is mostly used to replace chained INSERT and APPEND 
operations.
The downside of the /into option is that you have to be careful when 
using it or your code won't be task-safe. Your multiple references 
to a block that can change scenario is an example that can quite 
easily lead to task-unsafe code, for instance. But /into is great 
for micro-optimization and local code simplification, as long as 
you are careful to not modify shared structures without coordinating 
tasks.
Steeve
1-Oct-2010
[18540]
yeah indeed
BrianH
1-Oct-2010
[18541]
Of course task-safety isn't a problem for most R2 code, but then 
neither does R2 have natives with /into. Some of the new mezzanines 
though.
Maxim
1-Oct-2010
[18542]
for the record (for the other people reading, which might not be 
as fluent in the more low level aspects of the core)..


I just want to note that your comment about thread safety doesn't 
only apply specifically to the /into... 


It applies to *all* series usage in REBOL 3 since they are mutable 
and MANY functions modifiy series "in-place".


Other languages always copy on assign so its not as big an issue 
as in REBOL.
BrianH
1-Oct-2010
[18543]
Agreed. Though not many other languages always copy on assign - that's 
a relatively new habit.
Izkata
1-Oct-2010
[18544]
Or copy on any change, rather than on assign, as Java does with String
Gregg
3-Oct-2010
[18545x2]
Does anyone have a well-tested mezz version of CASE handy for use 
with older REBOL cores?
Ladislav's PIF is my first stop.
Graham
3-Oct-2010
[18547]
how old is old?
Gregg
3-Oct-2010
[18548]
1.2.47
Graham
3-Oct-2010
[18549]
I don't know where this came from:

	case: func [
		[throw catch]
		args [block!] /local res
	] [
		either unset? first res: do/next args [
			if not empty? args [
				; invalid guard
				throw make error! [script no-arg case condition]
			]
		] [
			either first res [
				either block? first res: do/next second res [
					do first res
				] [
					; not a block
					throw make error! [
						script expect-arg case block [block!]
					]
				]
			] [
				case second do/next second res
			]
		]
	]
Gregg
3-Oct-2010
[18550]
Thanks Graham!
Graham
3-Oct-2010
[18551]
looks like PIF!
Gregg
3-Oct-2010
[18552x2]
That's Ladislav's PIF, just renamed.
:-)
Graham
3-Oct-2010
[18554]
Yep ... !
Gregg
3-Oct-2010
[18555]
All roads lead to Ladislav.
Graham
3-Oct-2010
[18556x3]
Does anyone else experience the inability to read the clipboard ?
I can paste from the browser to notepad, and other apps, and it's 
just text, but .... the clipboard shows empty.  The problem will 
go away if I reboot though.
If I write to clipboard://, nothing is there either ...
Gregg
3-Oct-2010
[18559x2]
REBOL sometimes seems to get confused if there is data on the clipboard, 
possibly related to the format of the clipboard data. Writing can 
fail at times too IME. Clearing the clipboard before writing usually 
solves the problem for me.
I think this is also what messes up AltMe's clipboard behavior at 
times.
Graham
3-Oct-2010
[18561x2]
Correction, I can write to the clipboard:// and paste into other 
apps, but Rebol is seeing nonthing there.
I can paste this: test
from Rebol, but can not paste into a new instance of View
Gregg
3-Oct-2010
[18563]
Do you have any kind of clipboard monitoring software installed?
Graham
3-Oct-2010
[18564]
No, I don't
Gregg
3-Oct-2010
[18565]
What program are you writing data to the clipboard with?
Graham
3-Oct-2010
[18566x2]
if the clipboard were screwed .... then Altme wouldn't see it either??
I was just copying from Chrome's address bar .. and also writing 
to the clipboard using core.
Gregg
3-Oct-2010
[18568]
AltMe is built against an older core.
Graham
3-Oct-2010
[18569]
ok, let me raise up an old core
Gregg
3-Oct-2010
[18570]
What OS and what REBOL version?
Graham
3-Oct-2010
[18571x4]
Ahh...... !!
fails on 
>> rebol/version
== 2.7.7.3.1
works on 
>> rebol/version
== 2.7.6.3.1
Windows 7 prof
Gregg
3-Oct-2010
[18575]
Interesting, and very good to know.
Graham
3-Oct-2010
[18576]
I wonder what happened to the clipboard handling...
Gregg
3-Oct-2010
[18577x2]
Only RT can say, unless a changelog is posted somewhere.
Could be as simple as a change that tried to handle errors better 
and now fails for some reason.
Graham
3-Oct-2010
[18579x2]
started up view 2.7.6, pasted to clipboard and can't read in 2.7.7 
again.
I'd better log this to rambo