
@mflatt No hurry, I know you’re busy, but a few racket runtime questions: I’m working on debugging the chaperone-struct issue I mentioned in IRC yesterday (chaperone-struct reporting that I am trying to modify an immutable field on a struct that has no immutable fields). Got it running in a debugger and I’m seeing that the “immutables” array has values other than 0 and 1. Does it sound right to you that this seems fishy? If so, is there a tool you use to diagnose memory issues in the runtime? I tried turning on address sanitizer but it doesn’t look like the build process is set up for that to be easy to turn on.

Other values in immutables
does sound wrong. Do you have an example I can run?

For simple memory issues, sometimes building with --enable-sgcdebug
and running racketcgc
can detect an error

I wonder also if you might be looking at immutables
from an object that isn’t actually a Scheme_Struct_Type
instance

unfortunately, not having a lot of luck reducing it.

hmmm, it might not be the immutables array, but actually that its trying to look at parent fields in the current immutables array, and so running off the end

I’m looking at the stype struct that is present where its throwing the error. thanks for the —enable-sgcdebug tip. i’ll see what I can figure out

I bet that --enable-sgcdebug
won’t help, and that the problem is some pointer being used as the wrong kind of object

In the object that you’re looking at, does the type
field (the first short
) match a sensible tag number as listed in “stypes.h”?

val->type = 50

which is scheme_structure_type

That’s an instance of Scheme_Structure
, as opposed to Scheme_Struct_Type
. Are you going through the stype
field to get to the latter?

yes

I’m wondering if struct.c lines 6216 and 6217 should use st
instead of stype

@alama has joined the channel

because the field in question is from a parent type and we go through the trouble of computing loc_field_pos using the parent’s struct type in st
but use it to offset into a child’s immutables array using stype

That sounds right

er the current behavior or the suggested behavior?

making the change does get rid of my error, and would explain the strange values I was getting for stype->immutables[loc_field_pos]

Yes, your correction sounds right. I’ll find a small example and then push that repair.

great, thanks!

@mflatt here’s a test case: #lang racket
(struct foo (a [b #:mutable]))
(struct bar foo (c d))
(define a-bar (bar 0 1 2 3))
(impersonate-struct
a-bar
set-foo-b!
(lambda (bar b) 4))

Thanks! Mine is almost exactly the same

Does anyone know how to add line numbers to racketmod?

alternatively be able to escape out of a codeblock.

@leif I don’t think it’s possible, racketblock
& co. and codeblock
are based on different implementations. I’d suggest manually insert the line numbers with #,
inside the racketmod
.

@georges-duperon That works for racketblock
, but does not for racketmod

because of the #lang line.

The number gets inserted after the #lang, leaving with #lang 1 racket, rather than 1 #lang racket

@leif: What about using a racketblock
, and typesetting the #lang
with #,(hash-lang)
?

Hmm…that’s an intersting idea.

Give me a moment to try it

Great, thanks @georges-duperon that worked.

Raquette — Racket on Chez :wink: — sounds really exciting.
Another important story for the future, probably, is Racket targeting JavaScript.
Does thinking about the former make this a good time to think about the latter? Or on the contrary is that just too overwhelming?

@greg I think targeting Chez is a big step towards targeting JS

step 2 is Chez -> JS?

step 3 profit

no, step 2 is something like RacketScript, but using the infrastructure for Racket -> Chez

step 2 involves rewriting lots more C stuff in Racket

which makes Racket -> JS easier

err, step 1, rather

I was catching up today, and was reading a certain GH issue thread and appreciate it’s open to discussion what it means for “Racket to target JS”. I guess I’m coming at it from the PoV of now having logged a little time using ClojureScript to interact with things like React. And (a) it’s really fun and (b) I wish it were Racket instead. ¯_(ツ)_/¯

@greg which GH issue?

and yes, this is something I want a lot

and as @lexi.lambda says, the fact that the expander and port and regexp and path libraries are now in racket form will make this all much easier

perhaps this GH issue? https://github.com/vishesh/racketscript/issues/31

ah that

@lexi.lambda maybe? :smile:

With the whole investment into Racket portability (coming from moving to Chez) you have whetted our appetites! The idea of building custom DSLs for the browser (if it will be possible) opens a new range of possibilities. Also one day I may even be able to one day rewrite my main project on .NET in Racket… mindblowing!

Is there any way to make sure a group of words stays on the same line in scribble?

Namely, I want a superscript and to make sure it stays attached to the word.

SOmething like hello@superscript{world}?

@leif this maybe a silly hack, but have you tried using unicode non-breaking space?

@leif create an element that has a 'no-break
style name

@githree lol, nice.

@mflatt Ah, okay, thanks.