
I thought that when a thread is killed, any running system
will be terminated as well. But I experimented and found that this is not the case… Hmm.

But call-with-limits does kill them?

Pre- or post increment? (define a 2)
(define b (++ a))
(list a b)
Do you feel pre or post increment is the most natural?
The expression (++ a)
adds 1 to a and stores it in a. At the same time the result of (++ a)
can be the value of a
before or after.
I.e. should the result be (3 2) or (3 3)

Personally I prefer to return the new value

I find it more intuitive

But i even prefer to not return a value at all

Or that. In any case mutating and returning can be confusing.

If ++
“only” returned a value, it would be the same as add1
though, right?

And a mutating ++
would be add1!
:wink:

Thanks - I hope to hear more opinions.

Make it a poll! Say (++ a)
expands to (set! a (+ 1 a))
, would you prefer it to [1] also return the new value of a
, [2] also return the old value of a
, [3] return (void)
, [4] something else explained in the comments.

I voted return #<void>
because that is consistent with set!

That’s option [3], not [4] :slightly_smiling_face:

Derp! fixed

has someone made something for applying a reader within a block

What do you mean by that? There’s #reader
(https://docs.racket-lang.org/reference/reader.html#%28part._parse-reader%29) if that’s what you are asking for.

this consumes the rest of input

Choosing 4 because…
I would choose 3, because it’s consistent with how set!
currently works.
But if Racket’s set!
returns the set value, then I would choose 1, and I actually prefer this to be the case.

Perhaps you can give some examples?

(define melody
#readerralda/lang/reader
Clarinet: a b > c d e)

actually now that I think about it, there’s only so much I can do with this because read-syntax in ralda/lang/reader produces a module

Yeah… and I think the “consumes the rest of input” is also specific to ralda/lang/reader
. A reader doesn’t necessarily need to consume everything.


yeah I know, I am just trying to figure out if a module reader can be used as an inline reader. which I think is not possible. not in a nice way at least

I would not be here if I had not read that : - )

I think I need a separate reader from ralda/lang/reader, which is delimited and produces an expression instead of a module

Thanks, I’m glad to hear it!

Well in C++ ++a
returns the new value and a++
returns the old. So, I voted for 1 — and also you should customize #%app
to implement the latter for (a ++)
? :stuck_out_tongue:

Seriously, if it’s named ++
I think there’s no affordance and you can choose to do whatever you want, so you might as well choose the most-commonly useful thing: Return the new value. OTOH if you named it something set++!
then maybe there’s the affordance it should behave like set!
and return void. Opinions.

(a ++)
LOL (yes I know this is insane)

I think it can work out if you delimit the reader in some other way, e.g. with at-expressions. I think Jay has done something along these lines.

Has anyone made a regex or other facility for strictly validating URIs? I know about net/url-string
but that module is a lot more permissive than RFC 3986. I could take a stab at converting a regex made for another language, but I’m hoping to get out of it :stuck_out_tongue:

I feel like you might be able to get the right behavior using a custodian?

It’s common lisp, but I wrote this a couple years ago and it’s based off the RFC: https://github.com/massung/url/blob/master/url.lisp\|https://github.com/massung/url/blob/master/url.lisp
You want to scroll down to the lexer definition. The regex patterns are Lisa style, but should be straight forward to follow.

Anyway, if you wanted to port some of that to racket, it might fit your needs.

scheme convention is to indicate mutation by ! and not return a value which always trips me up, because most ‘funtional’ programming style ‘mutation’ does return a fresh value. I do see value in following conventions

I think the conclusion is, that if the choice is just between “before” and “after”, then everybody prefers “after”. And you are all correct, that ++
isn’t very Scheme/Racket-like.
I am working on implementing a version of Processing in Racket, and a subgoal for me, is to match all the base features. Porting simple Processing programs, should ideally be a matter of changing a little syntax only. Processing is basically Java+Graphics library+branding. Being Java they have both ++a and a++.
Interestingly, the Processing documentation of ++ is simply wrong. They describe a++
as being equivalent to a=a+1
. And since Java is a language with both statements and expressions, this is iffy at best.

That said, I think the most common use of ++
in Processing programs are in for-loops, and we use in-range
instead.

The thread might spawn another thread/create finalizers/etc

I voted other; I find myself without a prevailing opinion. Returning (void)
seems the most Rackety, but I think both value-returning versions of ++
in C-like languages are relevant to lots of programmers, so maybe if either of them is available, both should be. I think Arc’s (++ a)
returns the updated value, like ++a
in C, but I’ve usually just ignored its result.