Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

F# Inline Function Specialization -


my current project involves lexing , parsing script code, , such i'm using fslex , fsyacc. fslex lexbuffers can come in either lexbuffer<char> , lexbuffer<byte> varieties, , i'd have option use both.

in order user both, need lexeme function of type ^buf -> string. far, attempts @ specialization have looked like:

let inline lexeme (lexbuf: ^buf) : ^buf -> string ^buf : (member lexeme: char array) =   new system.string(lexbuf.lexeme)  let inline lexeme (lexbuf: ^buf) : ^buf -> string ^buf : (member lexeme: byte array) =   system.text.encoding.utf8.getstring(lexbuf.lexeme) 

i'm getting type error stating function body should of type ^buf -> string, inferred type string. clearly, i'm doing (majorly?) wrong.

is i'm attempting possible in f#? if so, can point me proper path?

thanks!

functions , members marked inline cannot overloaded, original strategy won't work. need write different code both of declarations, need use overloading (if want write without boxing , dynamic type tests).

if you're using standard f# tools, type you'll buffer lexbuffer<'t> , want have 2 overloads based on type argument. in case, don't need static member constraints @ , can write just:

type utils =    static member lexeme(buf:lexbuffer<char>) =      new system.string(buf.lexeme)   static member lexeme(buf:lexbuffer<byte>) =      system.text.encoding.utf8.getstring(buf.lexeme) 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -