Am Freitag, den 15.02.2008, 20:53 +0000 schrieb Jon Harrop:
> Joachim Durchholz wrote:
> > Am Freitag, den 15.02.2008, 06:10 +0000 schrieb Jon Harrop:
> >> Joachim Durchholz wrote:
> >> > Just to complement Jon's view: I don't think there are any
*serious*
> >> > problems with recovering indented code from web pages or mail
quotes.
> >> > Just make sure that whitespace is properly handed through, that's
all,
> >> > and it's not even difficult. Hey, Evolution will even strip the
angle
> >> > brackets when copying from quoted mail ;-)
> >>
> >> Ugh. I was bitten by this *again* yesterday, trying to cut and paste
some
> >> F# code from a blog article and Windows removed all "\n"s.
> >
> > Strange - I wouldn't have expected to lose line breaks when copying
from
> > a web page. Possibly it was formatted using <br />, though even then,
> > the line breaks should be preserved. This sounds like something
awfully
> > braindamaged happening in the database->blog->server->browser chain.
> >
> > If code is represented using <pre>, you should get everything
(including
> > indentation) faithfully preserved on copy&paste. I could imagine that
> > tab-based indentation could still break in some cir***stances, but I
> > wouldn't recommend using that anyway.
>
> The code was color syntax highlighted:
>
>
http://jyliao.blogspot.com/2008/02/learning-wpf-with-f-toolbars-and-status.html
>
> >> In the end I used
> >> my Linux box to cut and paste into a text file that I loaded into the
> >> Windows box using putty and then cut and pasted that (correctly
> >> formatted) into Visual Studio...
> >
> > Sounds like brain damage in your browser.
>
> MSIE 7.
Well, I got the syntax highlighted code easily copied and pasted, using
Firefox and some simplicistic editor.
> > Copying from the source might have worked, too.
>
> The source HTML looks like:
>
> <span style="color:#008000;">//</span><br><span
style="color:#008000;">//
> Defining drop function...couldn't find a Seq equivalent</span><br><span
> style="color:#008000;">// I see Seq.take and Seq.truncate but no
> Seq.drop</span><br><span style="color:#0000FF;">let</span><span
> style="color:#;"> </span><span style="color:#0000FF;">rec</span><span
> style="color:#;"> seqdrop n (list:seq<'a>) =</span><br><span
> style="color:#;"> </span><span style="color:#0000FF;">if</span><span
> style="color:#;"> n<=0 </span><span
> style="color:#0000FF;">then</span><span style="color:#;">
> list</span><br><span style="color:#;"> </span><span
> style="color:#0000FF;">else</span><br><span style="color:#;">
> </span><span style="color:#0000FF;">match</span><span style="color:#;">
> (List.of_seq list) </span><span style="color:#0000FF;">with</span><span
> style="color:#;"> </span><br><span style="color:#;"> | _ :: []
</span>
Now that is braindamaged. A simple
<pre style="color:#008000;">
let seqdrop2 n list =
Seq.to_list list
|> List.rev
|> List.to_seq
|> Seq.truncate n
|> Seq.to_list
|> List.rev
|> List.to_seq
</pre>
would have worked, too, and been far more copy&paste-friendly.
Um... unless, of course, you want to syntax highlight individual lexical
elements like on the code snippets given farther down the page, so it
may be just a degenerate case. Even that code would copy&paste without a
hitch though, so it really seems to be a tool problem.
> Regardless, type throwback already solved the problem you're referring
to.
> F# provides all of these benefits and it works beautifully, a dream come
> true!
Hm. Given that you have a track record of extremely positive or negative
judgements, I'll withhold mine for a while.
Personally, I'm more than a little concerned about MS' lock-in
strategies behind .net, so F# would have to be orders of magnitude
better than anything else to make me even remotely interested.
Regards,
Jo


|