Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

OCaml records/field names

Name: Anonymous 2010-12-06 18:25

If anyone knows OCaml, could you tell me why field names alias those of other records? Is this just a product of the type inference or is there some deeper reason?

It seems unnecessarily limiting to me, but I'm not really deep enough into it to tell how much I'll be using records from the same namespace.

Name: 2010-12-06 18:59

Name: »2 at least you saged 2010-12-06 20:21

Name: 2010-12-06 20:32

>>3
It is my All Threads Will Be Replied to, NO EXCEPTIONS Enforcer. It sages by default.

Name: Anonymous 2010-12-06 20:52

>>1
It's what broke the Ocaml's back.

Name: Anonymous 2010-12-06 21:23

bump for niggers

Name: ­ 2010-12-07 0:36

­

Name: Anonymous 2010-12-07 4:11

What do you mean? I know OCaml, but don't understand the question.

Name: Anonymous 2010-12-07 4:45

OBaml

Name: Anonymous 2010-12-07 6:59

>>8
Eg.:
# type one = { a: int; b: float; };;
type one = { a : int; b : float; }
# type two = { c: int; a: float; };;
type two = { c : int; a : float; }
# let x = { b = 3.; a = 4; };;
Error: The record field label a belongs to the type two
       but is mixed here with labels of type one


The inferencer is very eager to come to a decision. If I specify 'a' first, the error just complains about int vs. float and leaves it at that.

Name: Anonymous 2010-12-07 8:45

Ah, indeed. It's a minor annoyance though: you don't need too much records in one module usually.

Name: Anonymous 2010-12-07 10:20

># let x = { b = 3.; a = 4; };;
>3.

Name: Anonymous 2010-12-07 10:22

>>12
I'm not sure you're a programmer.

Name: Anonymous 2010-12-07 10:31

>>13
usually syntax is important

Name: Anonymous 2010-12-07 10:33

>>14
Perhaps this will help.
$ bc
scale = 1
1/2
.5

Name: Anonymous 2010-12-07 10:35

psht int values can't have a decimal

Name: Anonymous 2010-12-07 10:37

>>16
It doesn't.

Name: Anonymous 2010-12-07 10:39

"3." ?

Name: Anonymous 2010-12-07 10:44

>>18
b: float;
b = 3.;
Are we done here?

Name: Anonymous 2010-12-07 11:18

are we?

Name: Anonymous 2010-12-07 12:54

>>20
Well I am, and you are , but is the Sussman done trolling us? That, my friend, is the real question.

Name: Anonymous 2010-12-07 17:14

>>11
Thanks. I had a feeling it was like that. Do you know why this is? I'm not turned off, just curious.

Name: Anonymous 2011-02-04 18:59

Don't change these.
Name: Email:
Entire Thread Thread List