boolean to string = hang (sometimes)

Scratching my head over this one. I have a handler that gathers debug information from variables and formats them as a string.

Sor some reason, the boolean values are causing a hang. Before I had them as part of the longer string, but found in separating them out that this statement caused the hang:

set thebooleans to "remote pw assigned: " & ((remotepw ≠ "") as string) & r & "localhome: " & localhome & r & "local pw assigned: " & ((localpw ≠ "") as string) & ret & "remotemounted: " & (remotemounted as string) & r & "loalmounted: " & (localmounted as string) & r & "netchecked: " & (netchecked as string) & ret

However this only happens AFTER another handler is called that sets some of these values, and IF that other handler encounters an error, which is trapped. So my thought is that maybe one or more of those variables could be left in some sort of half-state?? Who knows. What I need is an effective work-around.

maybe you can try replacing b as string[/b] with a custom boolean to string coercion?


to coerceBoolToString(theExpression)
	if (theExpression) then
		return ("true")
	else
		return ("false")
	end if
end coerceBoolToString

set thebooleans to "remote pw assigned: " & (my coerceBoolToString(remotepw ≠ "")) & r & "localhome: " & localhome & r & "local pw assigned: " & (my coerceBoolToString(localpw ≠ "")) & ret & "remotemounted: " & my coerceBoolToString(remotemounted) & r & "loalmounted: " & my coerceBoolToString(localmounted) & r & "netchecked: " & my coerceBoolToString(netchecked) & ret

Have you tried implicit coercions? (Just let the values get coerced automatically.)

set thebooleans to ¬
	"remote pw assigned: " & (remotepw ≠ "") & return & ¬
	"localhome: " & localhome & return & ¬
	"local pw assigned: " & (localpw ≠ "") & return & ¬
	"remotemounted: " & remotemounted & return & ¬
	"loalmounted: " & localmounted & return & ¬
	"netchecked: " & netchecked & return

Also, have you tried giving the variables a default value (maybe false or an empty string).