Note that String.Concat (and therefore your (+=) operator) does not affect an existing string but returns a new string, so the operator won't actually perform a new assignment on your mutable variable. I don't think there's any way to do what you want with a mutable variable, but you could do this with a ref instead:

1
2
3
4
5
let (+=) s (s':string) = s := !s + s' // or s := String.Concat(!s,s')

let sql = ref ""
sql += "insert into ..."
sql += "SELECT DISTINCT ..."
By on 6/7/2010 9:14 AM ()
1
2
3
4
5
let (+=) s (s':string) = s := !s + s' // or s := String.Concat(!s,s')

let sql = ref ""
sql += "insert into ..."
sql += "SELECT DISTINCT ..."

We shouldn't suggest this kind of dark magic [:)]

By on 6/7/2010 9:44 AM ()

What dark magic are you referring to?

Mutable variables? Infix operators?

By on 6/8/2010 10:24 AM ()

Post

more

details.

But try

1
open System

.

By on 6/7/2010 8:46 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper