Re: [racket-users] define fails at runtime, where let fails at compile time

2019-03-11 Thread Philip McGrath
I think it's fair to say that the Racket style guide is not as rigid as some other style guides for some other languages: as it says itself in the introduction, it "isn’t complete and it isn’t perfect" and is more a set of "guidelines and best practices" than binding universal rules. I think it is

Re: [racket-users] define fails at runtime, where let fails at compile time

2019-03-11 Thread Brian Adkins
On Monday, March 11, 2019 at 1:22:48 PM UTC-4, Matthias Felleisen wrote: > > > > > On Mar 11, 2019, at 1:18 PM, Brian Adkins > wrote: > > > > I want let semantics, but I've been using define more because it's > preferred in the Racket style guide. I don't want the behavior of define > above, s

Re: [racket-users] define fails at runtime, where let fails at compile time

2019-03-11 Thread Brian Adkins
Yes, I hadn't really thought through the semantics of define (i.e. whether it had let or letrec semantics). So, in my case, since I want let semantics, I will use let. I'm happy to follow the Racket style guide when I get to the point of contributing code that is covered by it, but I think I wi

Re: [racket-users] define fails at runtime, where let fails at compile time

2019-03-11 Thread Matthias Felleisen
> On Mar 11, 2019, at 1:18 PM, Brian Adkins wrote: > > I want let semantics, but I've been using define more because it's preferred > in the Racket style guide. I don't want the behavior of define above, so > using letrec to get a runtime error instead of compile time error doesn't > make s

Re: [racket-users] define fails at runtime, where let fails at compile time

2019-03-11 Thread Brian Adkins
On Monday, March 11, 2019 at 1:13:30 PM UTC-4, Brian Adkins wrote: > > > > On Monday, March 11, 2019 at 12:29:40 PM UTC-4, Matthias Felleisen wrote: >> >> >> >> > On Mar 11, 2019, at 11:21 AM, Brian Adkins wrote: >> > >> > I just discovered that define will fail at runtime, where let would >>

Re: [racket-users] define fails at runtime, where let fails at compile time

2019-03-11 Thread Greg Hendershott
To be fair: As a new user, it's possible to have the intuition that `define` is just a way to avoid indentation -- that it "writes a `let` for you, from the point of the define to 'the end of the enclosing scope'". And it's possible for that intuition to seem correct for a very long time -- until

Re: [racket-users] define fails at runtime, where let fails at compile time

2019-03-11 Thread Brian Adkins
On Monday, March 11, 2019 at 12:29:40 PM UTC-4, Matthias Felleisen wrote: > > > > > On Mar 11, 2019, at 11:21 AM, Brian Adkins > wrote: > > > > I just discovered that define will fail at runtime, where let would fail > at compile time. Besides helping to keep the indentation level from > mar

Re: [racket-users] define fails at runtime, where let fails at compile time

2019-03-11 Thread Matthias Felleisen
> On Mar 11, 2019, at 11:21 AM, Brian Adkins wrote: > > I just discovered that define will fail at runtime, where let would fail at > compile time. Besides helping to keep the indentation level from marching to > the right "too much", what are the benefits of define over let? > > --- snip -

[racket-users] define fails at runtime, where let fails at compile time

2019-03-11 Thread Brian Adkins
I just discovered that define will fail at runtime, where let would fail at compile time. Besides helping to keep the indentation level from marching to the right "too much", what are the benefits of define over let? --- snip --- #lang racket (define (f n) (+ n 1)) (define (foo) (define b (f