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

World: r3wp

[Core] Discuss core issues

Gregg
8-Jan-2010
[15428x2]
Needs a different name too, as Ladislav has a nice BUILD func that 
works on blocks.
I need a spec first. ;-)
Terry
8-Jan-2010
[15430x3]
Although, i would be impressed if it didn't choke while trying to 
escape stuff.
If it was a smple matter of replacing variables with values.. i have 
some °7° code that does that.
The problem is well formed javascript to send back to the DOM.
via AJAX
Steeve
8-Jan-2010
[15433]
I say it again, you didn't give us the real output. Doing some assumptions, 
i got this.

varA: { \'hello\'s ^{Worlds \';}
varB: {
 'and ^{so "on';
}

print rejoin  [{<button onclick="alert('} varA {');">CLICK ME</button>} 
varB ]


<button onclick="alert(' \'hello\'s {Worlds \';');">CLICK ME</button>
 'and {so "on';

So where is the burden ? i don't see one
Terry
9-Jan-2010
[15434x2]
Should probably put this in rant.. but just spent the last hour wondering 
why my function wasn't working

result: sofp 'firstname'

the solution? change the single quotes to double.. aye carumba
Steeve, it's cumbersome.. I spend more time joining and escaping 
than anything else.
Henrik
9-Jan-2010
[15436x2]
From all this, the easiest way would be to produce a dialect that 
does its own escaping, so you don't have to write JS at all.
rephrasing that: not "easiest way", but easiest to use in the end.
Janko
9-Jan-2010
[15438]
as anyone tried to run cheyenne or rebol on sheevaplug ( http://www.globalscaletechnologies.com/t-sheevaplugdetails.aspx
)
WuJian
9-Jan-2010
[15439]
Good stufff
Henrik
13-Jan-2010
[15440]
does anyone have a rebol based bracket checking tool? preferrably 
something that can be integrated into a diagnostic tool.
Steeve
13-Jan-2010
[15441]
hey ?
WuJian
14-Jan-2010
[15442]
e
	)
BenBran
14-Jan-2010
[15443]
I have the code:
case equal? length? find myLine "text" 4 [...]
It fails on ==none
I can do it in more lines of code but was wondering the 
shortest way to get past this.
Any suggestions?
tia
Graham
14-Jan-2010
[15444]
what happens if you don't find the text ??  It gives none
BenBran
14-Jan-2010
[15445x2]
yes that is correct
I'd like to ignore if it gets 'none'
Graham
14-Jan-2010
[15447]
so you have multiple conditions but you're only checking for one
BenBran
14-Jan-2010
[15448x2]
yes have numerouse cases
numerous
Graham
14-Jan-2010
[15450x2]
I mean you have mulitiple outcomes in that code you have written 
but you're only checking for one
if mark: find myline "text" [
	... 

]
BenBran
14-Jan-2010
[15452]
I don't follow what you mean.
Graham
14-Jan-2010
[15453]
if all [
	mark: find myline "text" 
	4 = length? mark

][
	case [

	]
]
Maxim
14-Jan-2010
[15454]
the if isn't required here.
Graham
14-Jan-2010
[15455]
true
Maxim
14-Jan-2010
[15456]
this is exactly the same:

all [
	mark: find myline "text" 
	4 = length? mark

	case [

	]
]
Graham
14-Jan-2010
[15457]
all [
	mark: find myline "text"
	4 = length? mark
	case [

	]

]
Maxim
14-Jan-2010
[15458]
hehe
Graham
14-Jan-2010
[15459]
snap
BenBran
14-Jan-2010
[15460]
the power of rebol will never cease to amaze me.
Maxim
14-Jan-2010
[15461]
after a decade I still find new language tricks.  I call it the "temporary 
newbie moment" phenomenon... I've never had these moments in other 
languages.


its like finding a new trick to make your lego stuff stronger while 
having the same shape  ;-)
Steeve
15-Jan-2010
[15462]
case [
	not mark: find myline "text" [none]
	4 <> length? mark [none]
	...

]
Graham
15-Jan-2010
[15463]
not so easily read  ;)
Steeve
15-Jan-2010
[15464x6]
don't think so, matter of habit
is that less readable than a comnination of any/all/case/if ?
And you can align your code. 
CASE hase the most readable structure for complex tests
Why should have demonstrate such obvious thing ?
;-)

fail: [none]
case [
	not mark: find myline "text" 	fail
	4 <> length? mark 				fail
	...

]
*combination
and most of the time, it's the fastest way of doing tests
ALL is slow
Back in time digression...


I have often noticed that it is unemployed as a method for complex 
testings.

In general it's faster and more easily readable than a serie of nested 
if / else.

But to do such, the programmer must know how testings can be complemented 
and other simplification technics.

The novice programmers (whatever the language) often find it difficult 
to do it correctly.

This is probably a gap in computer education. We don't learn anymore 
the basics of Boolean algebra.

At least for me it is an important criterion to determine the general 
level of someone in computer sciences. 
If I see too many nested if / else in a program.
I think the personn lacks of solid foundations in programming.
Maxim
15-Jan-2010
[15470x7]
other languages promote it based on the general suckyness of the 
case statement in most languages.
which act more like switch than rebol`s case
people often forget that IF, EITHER & UNLESS return values
such as 

val: either success? [blue][red]

instead of

either success? [ 
	val: blue
][  
	val: red
]
and either in a compose is very powerfull... cause it allows conditional 
serie content creation).

; when false, an empty block is returned and compose ignores it.

draw-blk: compose [ (either gfx? [ [pen black circle 30x30 ][    
[ ]   ])]


this example is simple but when creating very complex draw blocks 
on the fly, I often have a few cascaded compose blocks, and in some 
cases, the resulting draw block is an empty block even if it takes 
100 lines to get to that.  the language will skip the nested composes 
if an outer condition is false, so in fact, its VERY fast.
oops missing a "]" bracket in the above.
and if you optimize you can do other stuff, but it gets unreadable 
real fast.
Steeve
15-Jan-2010
[15477]
It's not really my point here. There are advanced technics in Rebol 
to optimize the code. 
I don't  blame anyone to not know them all (me neither).

I was comparing nested (messy) testings structures vs. flat (readable) 
structures.

And the reason why people use the bad way and not the right way ;-)