Re: [racket-users] Re: Inadvertedly requiring racket/unsafe/ops

2019-12-14 Thread Eric Griffis
Unsafe operations are usually defined externally, like in a C extension,
where safety is harder to guarantee and module hierarchies are less
idiomatic. The "unsafe" moniker is a standard warning that you are
responsible for understanding the underlying implementation and calling
into it responsibly, or risk crashing.

The documentation, assuming you know this, explains how to swap the unsafe
variants into a module that already uses the safe API, effectively
bypassing safety features like contracts and dynamic dispatch.

If you're going to use unsafe operations, make sure you need the extra
juice and are confident nothing is going to break. This isn't just the deep
end of the pool -- it's the screws holding the drain to the bottom.

Eric


On Sat, Dec 14, 2019, 5:58 PM Jack Firth  wrote:

> I think that documentation fix is a good idea. More broadly, it seems
> awkward that all of the unsafe ops for different data types are combined
> together into a single module. I would instead expect there to be modules
> like racket/fixnum/unsafe, racket/struct/unsafe, racket/vector/unsafe, etc.
> But I've never used the unsafe ops before, maybe those who have can chime
> in?
>
> On Saturday, December 14, 2019 at 1:03:14 PM UTC-8, Dominik Pantůček wrote:
>>
>> Hello,
>>
>> the documentation at https://docs.racket-lang.org/reference/fixnums.html
>> is misleading at best. If you - as I did - use the suggested approach of
>> requiring optimized (and unsafe) fx... operations from racket/unsafe/ops
>> with:
>>
>> (require (filtered-in
>>   (λ (name) (regexp-replace #rx"unsafe-" name ""))
>>   racket/unsafe/ops))
>>
>> You end up using _all_ symbols from racket/unsafe/ops. All of them are -
>> of course - uncontracted. Which means that if you issue for example
>> vector-ref on something that is not a vector, it can crash the runtime
>> without any apparent reason - instead of just throwing an exception as
>> one would expect.
>>
>> A simple documentation fix should probably go along the lines:
>>
>> (require racket/require
>>  (filtered-in
>>   (λ (name)
>> (and (regexp-match #rx"^unsafe-fx" name)
>>  (regexp-replace #rx"unsafe-" name "")))
>>racket/unsafe/ops))
>>
>> Or is it just me running into corner cases with optimized Racket code?
>>
>>
>> Cheers,
>> Dominik
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/c118c47e-fccd-4fab-b252-7a24afe6eef1%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAORuSUxiZ%3DD9446pqs1cK2XCGzt1OHkoij5Kzf2-65QE_APyTA%40mail.gmail.com.


[racket-users] Re: Inadvertedly requiring racket/unsafe/ops

2019-12-14 Thread Jack Firth
I think that documentation fix is a good idea. More broadly, it seems 
awkward that all of the unsafe ops for different data types are combined 
together into a single module. I would instead expect there to be modules 
like racket/fixnum/unsafe, racket/struct/unsafe, racket/vector/unsafe, etc. 
But I've never used the unsafe ops before, maybe those who have can chime 
in?

On Saturday, December 14, 2019 at 1:03:14 PM UTC-8, Dominik Pantůček wrote:
>
> Hello, 
>
> the documentation at https://docs.racket-lang.org/reference/fixnums.html 
> is misleading at best. If you - as I did - use the suggested approach of 
> requiring optimized (and unsafe) fx... operations from racket/unsafe/ops 
> with: 
>
> (require (filtered-in 
>   (λ (name) (regexp-replace #rx"unsafe-" name "")) 
>   racket/unsafe/ops)) 
>
> You end up using _all_ symbols from racket/unsafe/ops. All of them are - 
> of course - uncontracted. Which means that if you issue for example 
> vector-ref on something that is not a vector, it can crash the runtime 
> without any apparent reason - instead of just throwing an exception as 
> one would expect. 
>
> A simple documentation fix should probably go along the lines: 
>
> (require racket/require 
>  (filtered-in 
>   (λ (name) 
> (and (regexp-match #rx"^unsafe-fx" name) 
>  (regexp-replace #rx"unsafe-" name ""))) 
>racket/unsafe/ops)) 
>
> Or is it just me running into corner cases with optimized Racket code? 
>
>
> Cheers, 
> Dominik 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/c118c47e-fccd-4fab-b252-7a24afe6eef1%40googlegroups.com.


[racket-users] Inadvertedly requiring racket/unsafe/ops

2019-12-14 Thread Dominik Pantůček
Hello,

the documentation at https://docs.racket-lang.org/reference/fixnums.html
is misleading at best. If you - as I did - use the suggested approach of
requiring optimized (and unsafe) fx... operations from racket/unsafe/ops
with:

(require (filtered-in
  (λ (name) (regexp-replace #rx"unsafe-" name ""))
  racket/unsafe/ops))

You end up using _all_ symbols from racket/unsafe/ops. All of them are -
of course - uncontracted. Which means that if you issue for example
vector-ref on something that is not a vector, it can crash the runtime
without any apparent reason - instead of just throwing an exception as
one would expect.

A simple documentation fix should probably go along the lines:

(require racket/require
 (filtered-in
  (λ (name)
(and (regexp-match #rx"^unsafe-fx" name)
 (regexp-replace #rx"unsafe-" name "")))
   racket/unsafe/ops))

Or is it just me running into corner cases with optimized Racket code?


Cheers,
Dominik

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/1262b01a-5e9c-180e-d02a-b2e331c1f3cc%40trustica.cz.


[racket-users] Call for Participation: Racketfest 2020

2019-12-14 Thread Jesse Alama
I'm pleased to announce

  Racketfest 2020
  February 27, 2020
  Berlin, Germany
  https://racketfest.com

We've got a great lineup of fantastic speakers, with multiple Racket topics 
represented. The 2020 edition will again be a one-day affair, this time in 
three parts: 

  * talks (we all know what those are)
  * learn & practice (gentle introductions to a Racket topic), and
  * fun (self-explanatory -- rumor has it that there will be Racket-powered 
games and Racket-powered Raspberry Pis)

See the web page for more details. To register, just go to

  https://racketfest.com/register .

Racketfest pairs with BOB (https://bobkonf.de/2020/en/), happening the day 
after (Friday, February 28). If you register for Racketfest, you can get a 
discounted BOB ticket. To top all of this off, on Saturday, February 29, 
:clojureD, a large German Clojure conference, will also be taking place 
(https://clojured.de).

Hope to see you there!

— The Racketfest Organizing Committee

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/183bf9a9-ca49-402e-8972-6e6ae966821e%40googlegroups.com.