Kevin Forchione | 29 Aug 23:10 2014
Picon

variable wrong procedure or structure-type shape error?

Hmmmm…. something changed between Racket 6.1 and the latest release that is producing this mysterious
(to me at least!) error in a project of mine that compiles fine with 6.1, but not with the latest version,
producing: 

Welcome to DrRacket, version 6.1.0.5--2014-08-28(a1f5340/a) [3m].
Language: racket [custom]; memory limit: 512 MB.
link: bad variable linkage;
 reference to a variable that has the wrong procedure or structure-type shape
  reference phase level: 0
  variable module: "/Users/lysseus/Racket/games/lib/matrix.rkt"
  variable phase: 0
  reference in module: "/Users/lysseus/Racket/games/2048/2048-obj.rkt" in: matrix-row

Any idea wheat this error means and why 6.1.0.5 is getting the error? It appears to have been introduced
sometime after version 6.1.0.5--2014-08-25(32ae3f8/a) [3m]., which compiled fine.

-Kevin
_________________________
  Racket Developers list:
  http://lists.racket-lang.org/dev

Kathi Fisler | 27 Aug 02:42 2014

Call for Participation: SPLASH Educators Symposium

  SPLASH-E Call for Participation
 Tuesday, Oct 21 2014, Portland OR
     In conjunction with the SPLASH conference

SPLASH-E is a forum for software and languages researchers with
activities and interests around computing education.  This year's
SPLASH-E will feature sessions around three themes:

  * Creating (and Assessing) Projects and Courses to Engage Students
  * Design Issues around Drag-and-Drop languages
  * Designing Software Engineering Courses

as well as time dedicated to impromptu discussion around these and
other topics that arise.  Formal presentations will be short (15-20 minutes),
designed to raise questions for discussion rather than to simply present 
papers.

The PC is framing discussion questions within each theme, but also
welcomes questions on these topics from the broader SPLASH community.
If you have a research question or idea related to these themes and
plan to attend, drop me a line so we can include your question in the
discussion period.

Come experience an interactive day of discussion on educational
aspects of software systems.  Hope to see you in Portland!

Kathi Fisler
SPLASH-E chair

_________________________
  Racket Developers list:
  http://lists.racket-lang.org/dev
Neil Toronto | 16 Aug 14:55 2014
Picon

Should `register-finalizer` unwrap impersonators?

Short version: the contract system doesn't allow `register-finalizer` to 
be used in Typed Racket.

Long version: consider the following Typed Racket program, in which 
instances of `os-resource-wrapper` represent an operating system 
resource `os-resource`, which itself is just a counter. It attempts to 
register a finalizer for allocated wrappers, which decrements the counter.

#lang typed/racket

(require/typed
  ffi/unsafe
  [register-finalizer  (All (A) (-> A (-> A Any) Void))])

(: os-resource Integer)
(define os-resource 0)

(struct os-resource-wrapper ())

(: alloc-os-resource (-> os-resource-wrapper))
(define (alloc-os-resource)
   (set! os-resource (add1 os-resource))
   (define w (os-resource-wrapper))
   (register-finalizer w (λ (w) (set! os-resource (sub1 os-resource))))
   w)

(define w (alloc-os-resource))
(printf "os-resource = ~v~n" os-resource)
(collect-garbage)
(sleep 1)  ; give finalizers a chance to run
(printf "os-resource = ~v~n" os-resource)

I get this output:

   os-resource = 1
   os-resource = 0

The finalizer is being run while the program still has a pointer to the 
wrapper object. I think it's because the wrapper object is being 
impersonated when it's sent across the contract barrier, and the 
*impersonator* is getting the finalizer. (Or it's a chaperone, or an 
impostor, or a charlatan, or whatever. Let's go with impersonator.)

In my specific case, the OS resources are OpenGL objects; e.g. vertex 
object arrays. The call to `register-finalizer` *must* be in Typed 
Racket code because the wrapper contains an (Instance GL-Context<%>), 
which can't have a contract put on it, so it can't pass from untyped to 
typed code.

Is there any reason for `register-finalizer` to behave this way? Does it 
ever make sense to register a finalizer on an impersonator?

Neil ⊥
_________________________
  Racket Developers list:
  http://lists.racket-lang.org/dev
Stephen Chang | 15 Aug 20:33 2014

internal-definition-context-seal doesn't seem to do anything

The docs say that if I make an internal definition context with
syntax-local-make-definition-context, I have to seal it with
internal-definition-context-seal, otherwise an exception gets raised.
But I can't get this to happen. Does someone have an example that
causes the exception to get thrown?

For example, this program from the racket tests produces the same
result if I comment out the seal line. Other tests behave similarly.

(define-syntax (bind stx)
  (syntax-case stx ()
    [(_ handle def)
     (let ([def-ctx (syntax-local-make-definition-context)]
           [ctx (cons (gensym 'intdef)
                      (let ([orig-ctx (syntax-local-context)])
                        (if (pair? orig-ctx)
                            orig-ctx
                            null)))]
           [kernel-forms (list #'define-values)])
       (let ([def (local-expand #'def ctx kernel-forms def-ctx)])
         (syntax-case def ()
           [(define-values (id) rhs)
            (begin
              (syntax-local-bind-syntaxes (list #'id) #f def-ctx)
              (internal-definition-context-seal def-ctx)
              #'(begin
                  (define-values (id) rhs)
                  (define-syntax handle (quote-syntax id))))]
           [_ (error "no")])))]))

(define-syntax (nab stx)
  (syntax-case stx ()
    [(_ handle)
     (syntax-local-value #'handle)]))

(let ()
  (bind h (define q 5))
  (define q 8)
  (nab h))
_________________________
  Racket Developers list:
  http://lists.racket-lang.org/dev

Ryan C | 11 Aug 22:30 2014
Picon

Sandboxed evaluations throwing error from command line, but not from DrRacket

Howdy all,

I've been having an issue with sandboxed evaluations when requiring certain libraries, such as pict or 2htdp/image. I create a module evaluator and provide #:allow-for-require '(pict 2htdp/image etc.). I have this wrapped in a hand-in server type setup. When I start servlet.rkt in DrRacket, everything runs hunky-dory. When I run "racket servlet.rkt", the server spins up fine but when I try "(require pict) (circle 10)" (which works on the DrRacket-initialized one) I get an exception stating that file-read access 'exists' denied for C:\...(current directory)\racket.exe. Then I tried adding (current-directory) to the #:allow-read list, and it complains about C:\Python\racket.exe. If I continue allowing read paths, I see it effectively scans a ton of folders looking for this executable. Yet, when the servlet is started from DrRacket, this is never an issue. Any idea what the source of this discrepancy might be?

Thanks,
Ryan
_________________________
  Racket Developers list:
  http://lists.racket-lang.org/dev
Matthew Flatt | 12 Aug 06:16 2014
Picon

SGC as default

I've changed the Racket CGC implementation --- which is mostly used
only to build the normal Racket variant --- to use SGC by default,
instead of the Boehm GC. The intent of the switch is to make the more
portable GC the default.

If you have an existing build in a repo checkout, then `make` is likely
to fail, because the makefile dependencies are not precise enough to
deal with the switch. You can discard your old build directory, or it
might work to simply delete

  <builddir>/racket/libmzgc.a

If you're using CGC and want to continue using the Boehm GC, then
provide `--disable-sgc` to `configure`. I've tuned SGC to bring its
performance closer to the Boehm GC, but it's still slower.

_________________________
  Racket Developers list:
  http://lists.racket-lang.org/dev

Chris | 3 Aug 03:33 2014

Documentation Update for 6.1


> Hi,
> 
> In trying to look up the documentation for some of the new features in the release it looks like the
documentation on  http://docs.racket-lang.org is still for 6.0.1
> 
> I was able to just use the local documentation, so it’s not a big deal. I just wanted to make sure it
didn’t fall through the cracks of the release.
> 
> Thanks for 6.1, by the way, it seems very solid.
> 
> -Chris

_________________________
  Racket Developers list:
  http://lists.racket-lang.org/dev
Roman Klochkov | 2 Aug 20:22 2014
Picon

Performance: bytes->string/locale

Tested on Racket 6.0.1

----

(define str (string->bytes/locale "abcdefghабвгде"))
(time
   (for ([i 1000000])
      (bytes->string/locale str)))

(time
   (for ([i 1000000])
      (bytes->string/utf-8 str)))
----

Windows 7 x32:

> (enter! "test.rkt")
cpu time: 859 real time: 908 gc time: 78
cpu time: 641 real time: 667 gc time: 16

Seems OK
Linux

$ uname -a
Linux veles 3.14-1-686-pae #1 SMP Debian 3.14.12-1 (2014-07-11) i686 GNU/Linux

$ /usr/racket/bin/racket
Welcome to Racket v6.0.1.
> (enter! "test.rkt")
cpu time: 3072 real time: 3075 gc time: 52
cpu time: 552 real time: 551 gc time: 8

Locale in both cases utf-8, so bytes->string/utf-8 and bytes->string/locale returns the same, but bytes->string/locale in Linux 6 times slower.
Is it fixable?

--
Roman Klochkov
_________________________
  Racket Developers list:
  http://lists.racket-lang.org/dev
Ryan Culpepper | 1 Aug 20:24 2014

Release Announcement for v6.1, second draft

The release announcement draft that I have so far is below.  Please
mail me new items and/or edits.
----------------------------------------------------------------------

Racket v6.1 raises an exception when a local variable is used before
its definition, instead of producing an #<undefined> value. (Thanks
to Claire Alvis.)

Since programs are rarely intended to produce #<undefined>, raising an
exception provides earlier and better feedback to programmer.
Module-level variables have always triggered an exception when used
too early, and this change makes local bindings --- including fields
within a class --- behave the same.

This is a backward-incompatible change to Racket. Aside from exposing
a few bugs, the change mainly affects programs that include

   (define undefined (letrec ([x x]) x))

to obtain the #<undefined> value. There is now no #<undefined> value
in the old sense, but the `racket/undefined` library (which was
introduced in the previous release) provides `undefined` for use in
place of the pattern above when an "undefined" value is still needed.

----

* Plumbers generalize the flush-on-exit capability of primitive
   output ports to enable arbitrary flushing actions and to give
   programmers control over the timing of flushes (i.e., a composable
   `atexit`).  New functions include `current-plumber`,
   `plumber-add-flush!`, and `plumber-flush-all`.

* contracts: the contract system's random testing facility has been
   strengthened so that it can easily find simple mistakes in
   contracted data structure implementations (e.g. an accidental
   reverse of a conditional in a heap invariant check).

* redex: the semantics of mis-match patterns (variables followed by
   _!_) inside ellipses has changed in a backwards incompatible way;
   they semantics is now much clearer and now potentially even
   useful. This change simplifies the patterns' semantics and
   increases the usefulness of these patterns.

* check-random is an addition to the preferred unit testing
   framework in the teaching languages. It enables the testing of
   students' functions that use random-number generation. (Thanks to
   David Van Horn (UMaryland) for proposing this idea.)

* Upgraded and normalized versions of graphics libraries and
   dependencies (Pango, Cairo, GLib, etc.) that are bundled with
   Racket on Windows and Mac OS X. For example, FreeType support is
   consistently enabled.

* The Typed Racket standard library includes contracted exports from
   the Racket standard library, such as racket/format's formatting
   combinators.

* Typed Racket now supports asynchronous channels using the
   `typed/racket/async-channel' library.

* The openssl library supports forward secrecy via DHE and ECDHE
   cipher suites (thanks to Edward Lee) and Server Name Indication
   (thanks to Jay Kominek).

----------------------------------------------------------------------
_________________________
  Racket Developers list:
  http://lists.racket-lang.org/dev

Antonio Menezes Leitao | 31 Jul 19:58 2014
Picon

Scribble bug?

Hi,

Scribble doesn't correctly render scaled bitmaps when the scale produces ratios in the width or height of the pict.

The following scribble program:

#lang scribble/base
<at> (require pict)
<at> (bitmap "foo.jpg")

generates an html file that includes:

<img style="vertical-align: 0px; margin: -3px -3px -3px -3px;" src="pict.png" alt="image" width="1587" height="977"/>

However, the following scribble program that scales the image:

#lang scribble/base
<at> (require pict)
<at> (scale-to-fit  (bitmap "foo.jpg") 1024 1024)

generates an html that includes:

<img style="vertical-align: 0px; margin: -3px -3px -3px -3px;" src="pict.png" alt="image" width="1030" height="1003790/1581"/>

Note the fraction, which Chrome does not parse correctly. The result is as an incredibly stretched image.

Best,
António.
_________________________
  Racket Developers list:
  http://lists.racket-lang.org/dev
Evgeny Odegov | 31 Jul 11:54 2014

Seg fault

Today some conditions met on my machine and DrRacket began to crash almost
immediately after run. So I reproduced it many times.

The results of last several crashes:

*  Seg fault (internal error) at 31a3a4c
   Seg fault (internal error) at 31a3a4c
   Seg fault (internal error) at 31a3a4c

*  Seg fault (internal error) at 25863a4c
   Seg fault (internal error) at 25863a4c
   Seg fault (internal error) at 25863a4c

*  Seg fault (internal error) at 29e93a4c
   Seg fault (internal error) at 29e93a4c
   Seg fault (internal error) at 29e93a4c

*  Seg fault (internal error) at 4223a4c
   Seg fault (internal error) at 4223a4c
   Seg fault (internal error) at 4223a4c

*  Seg fault (internal error) at 1c55392ac
   Seg fault (internal error) at 1c55392ac
   Seg fault (internal error) at 1c55392ac

*  Seg fault (internal error) at 256b41fc
   Seg fault (internal error) at 256b41fc
   Seg fault (internal error) at 256b41fc

Racket version: (32 bit x86) 6.1.0.2--2014-07-14(c7dd72a/a)
OS: Windows 7 Prof 64 bit

I also decided to try current snapshot 6.1.0.3--2014-07-30(f3a8883/a).
The crashes are repeated:

*  Seg fault (internal error) at 2b9c3a4c
   Seg fault (internal error) at 2b9c3a4c
   Seg fault (internal error) at 2b9c3a4c

*  Seg fault (internal error) at 28b53a4c
   Seg fault (internal error) at 28b53a4c
   Seg fault (internal error) at 28b53a4c

_________________________
  Racket Developers list:
  http://lists.racket-lang.org/dev


Gmane