caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Records misbehaviour
@ 2005-09-13 23:15 Lukasz Stafiniak
  2005-09-14  0:03 ` [Caml-list] " Jacques Garrigue
  2005-09-14  8:48 ` Andreas Rossberg
  0 siblings, 2 replies; 3+ messages in thread
From: Lukasz Stafiniak @ 2005-09-13 23:15 UTC (permalink / raw)
  To: caml users

While I haven't encounter this in my programming, it popped out in
another thread and I think something might be done about it:

#type t1 = {fst:int;snd:int};; 
#let p1 = {fst=1; snd=2};; 
#type t2 = {snd:int};; 
#{p1 with snd=4};; 
- : t2 = {snd = 4};; 

Best Regards,
Lukasz


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Records misbehaviour
  2005-09-13 23:15 Records misbehaviour Lukasz Stafiniak
@ 2005-09-14  0:03 ` Jacques Garrigue
  2005-09-14  8:48 ` Andreas Rossberg
  1 sibling, 0 replies; 3+ messages in thread
From: Jacques Garrigue @ 2005-09-14  0:03 UTC (permalink / raw)
  To: lukstafi; +Cc: caml-list

From: Lukasz Stafiniak <lukstafi@gmail.com>

> #type t1 = {fst:int;snd:int};; 
> #let p1 = {fst=1; snd=2};; 
> #type t2 = {snd:int};; 
> #{p1 with snd=4};; 
> - : t2 = {snd = 4};; 

Indeed, this is rather counter-intuitive.
So a bug report would be welcome :-)

Note however that there is no unsoundness here: the definition of
"with" happens to be "create a record with the provided fields,
extracting omitted ones from p1". If none are omitted, which is the
case here as t2 has only one field, then p1 is currently ignored.

Jacques Garrigue


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Records misbehaviour
  2005-09-13 23:15 Records misbehaviour Lukasz Stafiniak
  2005-09-14  0:03 ` [Caml-list] " Jacques Garrigue
@ 2005-09-14  8:48 ` Andreas Rossberg
  1 sibling, 0 replies; 3+ messages in thread
From: Andreas Rossberg @ 2005-09-14  8:48 UTC (permalink / raw)
  To: caml users

Lukasz Stafiniak wrote:
> While I haven't encounter this in my programming, it popped out in
> another thread and I think something might be done about it:
> 
> #type t1 = {fst:int;snd:int};; 
> #let p1 = {fst=1; snd=2};; 
> #type t2 = {snd:int};; 
> #{p1 with snd=4};; 
> - : t2 = {snd = 4};; 

I guess this is just an instance of the following:

# type t = {a:int};;
type t = { a : int; }
# {"hi" with a=5};;
- : t = {a = 5}

-- 
Andreas Rossberg, rossberg@ps.uni-sb.de

Let's get rid of those possible thingies!  -- TB


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-09-14  8:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-13 23:15 Records misbehaviour Lukasz Stafiniak
2005-09-14  0:03 ` [Caml-list] " Jacques Garrigue
2005-09-14  8:48 ` Andreas Rossberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).