<lavaflow>
when the racket documentation says something is deprecated, does that mean it's liable to be removed in the future, or just that it's out of favor in some way?
<lavaflow>
specifically I'm wondering about filename-extension and path-get-extension
<lavaflow>
the docs say filename-extension is deprecated, but I prefer it because path-get-extension also returns the . character which I'm just going to strip off anyway
<lavaflow>
but if filename-extension isn't going to be there in some future release, I'll just deal with that '.' and save myself the future hassle.
keep_learning has joined #racket
efm has quit [Remote host closed the connection]
dbmikus__ has quit [Ping timeout: 246 seconds]
Fernando-Basso has quit [Remote host closed the connection]
<greghendershott>
lavaflow: In my experience it's unlikely the deprecated thing will get removed for a very long time if ever
<greghendershott>
Usually there's a non-gratuitous reason for the new thing
<lavaflow>
I hadn't even considered that scenario. I'll have to think about that.
efm has joined #racket
caltelt_ has quit [Ping timeout: 245 seconds]
FreeFull has quit []
dddddd has quit [Remote host closed the connection]
keep_learning has quit [Remote host closed the connection]
lockywolf has joined #racket
lockywolf_ has joined #racket
keep_learning has joined #racket
lockywolf has quit [Remote host closed the connection]
dbmikus__ has joined #racket
lockywolf_ has quit [Ping timeout: 245 seconds]
fridim has quit [Ping timeout: 250 seconds]
fridim has joined #racket
enderby has joined #racket
Sgeo__ has joined #racket
sebastianlin_ has joined #racket
Sgeo_ has quit [Ping timeout: 250 seconds]
dbmikus__ has quit [Quit: WeeChat 2.4]
<lexi-lambda>
rjungemann: I don’t understand why an inline `cond` is likely to be any meaningfully faster than calling a function (and it bloats the code size for no reason).
lockywolf has joined #racket
enderby has quit [Remote host closed the connection]
lockywolf_ has joined #racket
lockywolf has quit [Ping timeout: 245 seconds]
lockywolf_ has quit [Read error: Connection reset by peer]
aeth has quit [Ping timeout: 268 seconds]
pera has quit [Ping timeout: 246 seconds]
aeth has joined #racket
ZombieChicken has quit [Ping timeout: 256 seconds]
sebastianlin_ has quit [Ping timeout: 256 seconds]
endformationage has quit [Ping timeout: 246 seconds]
<rjungemann>
I think you're right. I was making an assumption without any evidence. I'll keep playing with it. Thank you!
lockywolf__ has quit [Read error: Connection reset by peer]
lockywolf_ has joined #racket
lockywolf__ has joined #racket
lockywolf_ has quit [Read error: Connection reset by peer]
lockywolf__ has quit [Ping timeout: 246 seconds]
lockywolf__ has joined #racket
ricekrispie has quit [Read error: Connection reset by peer]
lockywolf__ has quit [Ping timeout: 246 seconds]
lockywolf has joined #racket
fanta7531 has joined #racket
fmu_ has joined #racket
caltelt_ has quit [Ping timeout: 250 seconds]
fmu has quit [Ping timeout: 246 seconds]
lockywolf has quit [Ping timeout: 244 seconds]
brendyyn has joined #racket
brendyyn has quit [Read error: No route to host]
libertyprime has quit [Read error: Connection reset by peer]
libertyprime has joined #racket
vraid has joined #racket
jao has quit [Ping timeout: 246 seconds]
iyzsong has joined #racket
jcowan has quit [Quit: Connection closed for inactivity]
jao has joined #racket
jcowan has joined #racket
jao has quit [Remote host closed the connection]
dddddd has joined #racket
brendyyn has joined #racket
libertyprime has quit [Ping timeout: 246 seconds]
libertyprime has joined #racket
orivej has quit [Ping timeout: 268 seconds]
libertyprime has quit [Quit: leaving]
fanta7531 has quit [Quit: fanta7531]
q9929t has joined #racket
brendyyn has quit [Read error: Connection reset by peer]
brendyyn has joined #racket
q9929t has quit [Quit: q9929t]
gnugnugnu has joined #racket
iclon has quit [Remote host closed the connection]
iclon has joined #racket
iyzsong has quit [Ping timeout: 252 seconds]
aeth has quit [Ping timeout: 246 seconds]
orivej has joined #racket
aeth has joined #racket
gnugnugnu has quit [Quit: WeeChat 2.4]
eddof13 has joined #racket
eddof13 has quit [Client Quit]
eddof13 has joined #racket
endformationage has joined #racket
vraid has quit [Quit: Leaving]
dan_f has joined #racket
pera has joined #racket
YuGiOhJCJ has joined #racket
jao has joined #racket
jao has quit [Ping timeout: 245 seconds]
jao has joined #racket
joelhed has joined #racket
selimcan has joined #racket
<joelhed>
Are contracts supposed to be used as assert statements are commonly used in imperative languages?
<bremner>
joelhed: I think the analogy with type annotations (or function protypes) is more precise.
<bremner>
except of course they are checked at runtime, like assertions
<bremner>
joelhed: they are a special kind of assertion, so you're not wrong
sauvin has quit [Read error: Connection reset by peer]
Sgeo has quit [Ping timeout: 245 seconds]
<joelhed>
Okay. Is it proper style then to write all kinds of checks, that limit the allowed values of function parameters, as contracts?
Sgeo has joined #racket
<bremner>
I don't know, I've mainly used typed variants of racket (which is unusual). Hopefully someone else has a better idea.
<bremner>
joelhed: did you have a look at the Contracts chapter of the Racket Guide?
<gonz_>
joelhed: I had an entire project based on it, but eventually removed it for code paths that were too intensive because it did actually have a performance penalty.
<gonz_>
That was a few years ago, though; I have no idea what the situation is now.
ubLIX has joined #racket
<gonz_>
I think it's a terrific thing to do because it also serves as a signal of intent. I'm not much for types in comments.
<joelhed>
gonz_: yeah, that's what I thought. It seems mostly useful for helping us write code, with some form of compile time switch for production versions, but at the same time seems to cover a whole bunch of potential use cases.
<joelhed>
Does such a switch even exist?
<gonz_>
Yeah, I could see a situation where you flag it away for prod but keep it for finding bad data flow in dev.
<gonz_>
I don't know of one
<gonz_>
It shouldn't be terribly hard to accomplish, though
<joelhed>
Macros, right?
<joelhed>
I've heard they can do anything, but I've yet to come to that chapter yet
<joelhed>
oops grammar
<gonz_>
Yes, what I would aim for would be to have a macro that only expands to an actual contract check under certain circumstances.
<gonz_>
Otherwise expands to a no-op
<gonz_>
But it's not something I've actively looked into
<gonz_>
A `(define/dev-contract (function-name arg1 arg2) ...)` macro would be nice, I guess. In dev it'd expand to `(define/contract ...)` and otherwise just `(define ...)`
<gonz_>
I'm disappointed that I never did this, actually
<joelhed>
Yeah, I mean, it seems like a niche issue, but it could be useful when the checks start slowing the application down.
<gonz_>
I'd heartily suggest making this your first macro to work towards
<gonz_>
It's a very neat feature and is a perfect use case for macros, IMO
<joelhed>
Haha, that sounds like a good idea! I'll see if I could use it in some project!
FreeFull has joined #racket
keep_learning_M has quit [Ping timeout: 250 seconds]
dan_f has quit [Quit: dan_f]
dan_f has joined #racket
keep_learning_M has joined #racket
<dzoe>
I am slightly struggling with quasisyntax and unsyntax-splicing, basically I am trying to use (dispatch-rules) from web-server/dispatch to create a wrapper that does not handle the request but rather returns the matching procedure.
<dzoe>
Which basically means I need to do (my-dispatch-rules (("some-path" maybe-args ...) function) ...) -> (dispatch-rules (("some-path" maybe-args ...) (lambda args function) ...))
<dzoe>
(Yes, it just throws away the arguments - it actually fits my needs quite well)
<dzoe>
The problem is if I try to write a recursive syntax macro, I end up with basically two macros, one that starts the (dispatch-rules ... expression and than the recursive one, that would produce the syntax list that I want to unquote-splicing in the first one.
<dzoe>
Of course, using syntax/parse as I need some things validated as strings, expressions, ids...
fmu_ has quit [Ping timeout: 244 seconds]
<dzoe>
In quasisyntax, I am unable to use template variables inside unquote-splicing sub-expression.
<dzoe>
Any hints?
<joelhed>
bremner: I'm reading it now actually! One issue I had with it was that it prompted you to use contracts primarily for module boundaries, which raised the question of how you should check and error on faulty parameter values when you're writing say a helper. Then I read the next section and all my questions were answered!
<dzoe>
Ah, syntax->datum, datum->syntax and define-for-syntax to the rescue.
<jcowan>
Using contracts for dev only is like using life jackets only while in port.
<technomancy>
maybe more like wearing helmets when the ship is under construction
<bremner>
surely there must be a car analogy here.
<gonz_>
jcowan: No, it's like having debug only asserts; a fairly common thing.
<gonz_>
And not an unreasonable thing either.
<jcowan>
I don't think it is reasonable at all.
eddof13 has quit [Quit: eddof13]
<bremner>
Can I sell you a type system :P
<bremner>
err, static type system
<gonz_>
Given a hot enough code path it's unreasonable to pay a cost for runtime checks on that code path
eddof13 has joined #racket
<gonz_>
If you can have it run in dev you can make it clear with dev-only contracts that that code path is fine
<gonz_>
This is not really philosophically different from a sophisticated enough type system allowing you to safely remove runtime bounds checks, etc.
jao has quit [Ping timeout: 246 seconds]
jao has joined #racket
cantstanya has quit [Remote host closed the connection]
<gonz_>
It's not an all or nothing proposition either. Certain code paths might have a conditional contract on them, preceding less traveled ones might have static contracts on them.
aeth has quit [Ping timeout: 255 seconds]
aeth has joined #racket
<jcowan>
Only if you can do truly comprehensive testing in dev.
<jcowan>
It's very different from automatically removed checks, where you have a proof that it can't go wrong.
<gonz_>
Sure, but this applies even with contracts in prod.
<gonz_>
You're SoL regardless
<gonz_>
and it's mostly because you're not using a language that checks beforehand
<gonz_>
Paying a runtime cost every time you call a function, for little to no gain in prod, just because you refuse to use a statically typed language... That's unreasonable, IMO.
<gonz_>
The least you can do at that point is to make sure that type errors are easy to catch in dev, have good testing and not have everyone pay extra costs at runtime.
jao has quit [Ping timeout: 255 seconds]
ZombieChicken has joined #racket
dan_f has quit [Quit: dan_f]
dan_f has joined #racket
dan_f has quit [Client Quit]
dan_f has joined #racket
ubLIX has quit [Quit: ubLIX]
dan_f has quit [Quit: dan_f]
selimcan has quit [Remote host closed the connection]
dan_f has joined #racket
eddof13 has quit [Ping timeout: 245 seconds]
Fernando-Basso has joined #racket
joelhed has quit [Ping timeout: 256 seconds]
dan_f has quit [Quit: dan_f]
dan_f has joined #racket
dan_f has quit [Quit: dan_f]
dan_f has joined #racket
Sgeo_ has joined #racket
Sgeo has quit [Ping timeout: 246 seconds]
dan_f has quit [Client Quit]
jao has joined #racket
Sgeo_ has quit [Read error: Connection reset by peer]
Arcaelyx has joined #racket
<jcowan>
gonz_: As you say, it depends on the circumstances. If you are willing to pay the up-front cost of static typing, then by all means use a statically typed language.
ohama has quit [Ping timeout: 250 seconds]
ohama has joined #racket
pera has quit [Quit: leaving]
vraid has joined #racket
jao has quit [Disconnected by services]
jao has joined #racket
efm has quit [Ping timeout: 268 seconds]
YuGiOhJCJ has quit [Quit: YuGiOhJCJ]
efm has joined #racket
enderby has joined #racket
efm has quit [Read error: Connection reset by peer]
Sgeo has joined #racket
efm has joined #racket
efm has quit [Ping timeout: 250 seconds]
enderby has quit [Ping timeout: 255 seconds]
enderby has joined #racket
jao has quit [Ping timeout: 245 seconds]
jao has joined #racket
Sgeo_ has joined #racket
sz0 has quit [Quit: Connection closed for inactivity]