Skip to content

Improve type-safety with data #5

@Drup

Description

@Drup

After having played a bit with d3 .. It's really easy to get exceptions by using data not exactly the way it's supposed to be used.

My understanding is that the safe idiom is :

selection
|. data (fun d i -> ... )
|- nest enter [ ... ]
|- nest update [ ... ]
|- nest exit [ ... ] 

with selection something obtained from select or selectAll (not run).

Is it right ? If that's the case, why not just hardcode it ?
I propose adding the type selection returned by selecting functions and:

val with_data : 
  selection -> ('a -> int -> 'b list) -> 
  enter:('b,'b) t -> update:('b,'b) t -> exit:('b,'b) t -> ('a, 'b) t

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions