logo       
Google Custom Search
    AddThis Social Bookmark Button

Re: Additions to extlib: msg#00088

Subject: Re: Additions to extlib
On Tue, Jun 29, 2004 at 09:41:21PM +0200, Bardur Arantsson wrote:
> > let myfunc x =
> >     let myret y = x + y
> >     in
> >     myret
> > ;;
> > 
> > When does the "scope" end?
> > 
> 
> I'd assume that a "scope" ends precisely when it is left
> by the program counter (PC), regardless of precisely what
> causes the PC to leave the region (be it an exception or
> just a case of regular return, or, in C++, goto), ie.

His point is what happens if myret is subsequently called, eg:

let myfunc x =
  let chan = open_in "filename" in  (* expecting this to get automagically
                                       closed *)
  let myret y =
    output_string chan (string_of_int y)
  in
  myret
  ;;

Then myret gets called later.

Rich.

-- 
Richard Jones. http://www.annexia.org/ http://www.j-london.com/
Merjis Ltd. http://www.merjis.com/ - improving website return on investment
Learning Objective CAML for C, C++, Perl and Java programmers:
http://www.merjis.com/richj/computers/ocaml/tutorial/


-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com



Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>