OK I found out the way of doing this
if links_sort_fun==sort_by_count ...
It's works. But why my match did not work too?
--- In ocaml_beginners%40yahoogroups.com">ocaml_beginners
yahoogroups.com, "bobshibby36"
<bobshibby36
...> wrote:
>
> Hi,
>
> I am working with an object :
>
> class state_view =
> object
> val mutable expanded : bool = true;
> val mutable links_opt : (string * int) list option = None;
> val mutable locals_opt : Ext.t option = None;
> val mutable links_options : Context.links_option list = [];
> val mutable links_sort_fun : links_sort_fun = sort_by_count;
>
> method expanded = expanded
> method links_opt = links_opt
> method locals_opt = locals_opt
> method links_options = links_options
> method links_sort_fun = links_sort_fun
>
> method set_expanded b = expanded <- b
> method set_links_opt l = links_opt <- l
> method set_locals_opt ext = locals_opt <- ext
> method set_links_options options = links_options <- options
> method set_links_sort_fun f = links_sort_fun <- f
>
> method copy = {< links_opt = None; locals_opt = None >}
> end
>
> the "links_sort_fun" is a function. I can put "sort_by_count" or
> "sort_by_feature" into it with the function "set_links_sort_fun
> (sort_by_feature/sort)"
>
> I need to know what is in this variable. So I verify but if I write :
>
> if (links_sort_fun = sort_by_feature) then ....
>
> It's compiled but I got an execution error.
>
> If I write :
>
> match links_sort_fun with
> sort_by_count -> ....
> | sort_by_feature ->....
>
> I ALWAYS match sort_by_count even if I would be supposed to have
> "sort_by_feature". And I got a warning telling me that the case line X
> (X is the line of | sort_by_feature -> ...) is unused :s
> Furthermore If I write
>
> match links_sort_fun with
> blbibljljlmqdsjfmqjf -> ...
> | ....
>
> That's the same thing, I always match blbibljljlmqdsjfmqjf ...
>
> So how can I know what is in this variable ?
>
.