sorawee
2020-12-27 08:17:24

I think of let as a “parallel assignment”. Here’s an example.


sorawee
2020-12-27 08:17:57

(define (f x y) (let ([y x] [x y]) (- x y)))


notjack
2020-12-27 12:56:27

honestly I’m of the opinion that you’re right, and therefore everyone should just always use define and let the schemify compiler pass figure it out


notjack
2020-12-27 12:57:08

Not yet but that would be so awesome, I recommend preserving this idea in a github issue


sorawee
2020-12-27 13:24:06

idk, define makes it impossible to shadow. In Rhombus, I hope that define doesn’t have letrec behavior.


samth
2020-12-27 13:25:10

@joshibharathiramana it doesn’t work if the second version has to refer to the first one



anything
2020-12-27 15:04:40

I love [the] historical background!! I seem to be unable to understand anything unless someone tells me the story!


notjack
2020-12-27 15:21:40

we could have a redefine form, though I’m not convinced either way that shadowing is worth that additional complexity


sorawee
2020-12-27 15:28:56

ML has define-like form that behaves like let, and when one wants it to be like letrec, just add the word “rec”.


badkins
2020-12-27 18:52:27

@notjack re: always using define and letting schemify figure it out, I think there are advantages to explicitness over implicitness


notjack
2020-12-27 18:54:21

I generally think there are too. I don’t think they outweigh the costs in this specific case.


badkins
2020-12-27 18:54:30

I can’t recall ever being surprised by the let family, but I have been surprised by define. I don’t like surprises when coding :)


badkins
2020-12-27 18:55:47

I guess I’m confused by the combination of “always use define” and “this specific case”, but that’s probably a tangent.


notjack
2020-12-27 18:56:35

“this specific case” = let vs define


badkins
2020-12-27 18:56:48

The only reason I’m commenting is it would be awful if Rhombus did away with the let family in favor of only having define.


notjack
2020-12-27 18:58:02

I don’t think it would be that bad honestly. Other languages manage just fine with only block-scoped variable declarations.


badkins
2020-12-27 18:58:42

To be clear, I’m speaking personally. It would be awful for me :)


badkins
2020-12-27 19:00:01

Racket/Scheme’s scoping is very high on my list of attractive features, and one that differentiates it from many languages IMO.


notjack
2020-12-27 19:08:58

Ah, gotcha. Would you be willing to share some code where you found it essential?


badkins
2020-12-27 20:14:13

badkins
2020-12-27 20:19:48

In this case, I prefer the explicitness of let, let* and letrec behaving in a specific way. I don’t like that define ’s behavior is context dependent.


badkins
2020-12-27 20:22:31

I also like the fact that let encloses variables, and the code depending on those variables in one list. It’s tidy.


hazel
2020-12-28 04:30:31

I’m not sure if this is a good question to ask in the beginners channel but here goes I guess I’m working through LACI (https://cs.uwaterloo.ca/~plragde/flaneries/LACI, it’s good) and I’m confused as to how to implement Kind as the type of types. I defined Kind to be a struct with no fields, and in my synthesis function I return Kind whenever synthesizing Type, and I error when synthesizing Kind


hazel
2020-12-28 04:31:56

(for context I literally do not know where/who to ask about this if not here)


hazel
2020-12-28 05:28:41

got it, I think