thinkmoore
2017-2-22 15:13:35

@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.


mflatt
2017-2-22 15:16:15

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


mflatt
2017-2-22 15:17:40

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


mflatt
2017-2-22 15:21:08

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


thinkmoore
2017-2-22 15:21:21

unfortunately, not having a lot of luck reducing it.


thinkmoore
2017-2-22 15:21:55

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


thinkmoore
2017-2-22 15:23:06

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


mflatt
2017-2-22 15:24:01

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


mflatt
2017-2-22 15:25:00

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”?


thinkmoore
2017-2-22 15:29:12

val->type = 50


thinkmoore
2017-2-22 15:29:16

which is scheme_structure_type


mflatt
2017-2-22 15:34:14

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?


thinkmoore
2017-2-22 15:36:33

yes


thinkmoore
2017-2-22 15:37:30

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


alama
2017-2-22 15:37:46

@alama has joined the channel


thinkmoore
2017-2-22 15:38:56

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


mflatt
2017-2-22 15:39:14

That sounds right


thinkmoore
2017-2-22 15:40:14

er the current behavior or the suggested behavior?


thinkmoore
2017-2-22 15:41:04

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


mflatt
2017-2-22 15:42:20

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


thinkmoore
2017-2-22 15:42:32

great, thanks!


thinkmoore
2017-2-22 15:49:18

@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))


mflatt
2017-2-22 15:49:34

Thanks! Mine is almost exactly the same


leif
2017-2-22 19:50:38

Does anyone know how to add line numbers to racketmod?


leif
2017-2-22 19:50:52

alternatively be able to escape out of a codeblock.


georges-duperon
2017-2-22 20:00:29

@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.


leif
2017-2-22 20:04:37

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


leif
2017-2-22 20:04:43

because of the #lang line.


leif
2017-2-22 20:05:02

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


georges-duperon
2017-2-22 20:07:30

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


leif
2017-2-22 20:08:19

Hmm…that’s an intersting idea.


leif
2017-2-22 20:08:23

Give me a moment to try it


leif
2017-2-22 20:10:05

Great, thanks @georges-duperon that worked.


greg
2017-2-22 22:41:08

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?


samth
2017-2-22 22:45:03

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


greg
2017-2-22 22:45:32

step 2 is Chez -> JS?


greg
2017-2-22 22:45:38

step 3 profit


samth
2017-2-22 22:46:02

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


lexi.lambda
2017-2-22 22:46:11

step 2 involves rewriting lots more C stuff in Racket


lexi.lambda
2017-2-22 22:46:16

which makes Racket -> JS easier


lexi.lambda
2017-2-22 22:46:28

err, step 1, rather


greg
2017-2-22 22:48:32

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. ¯_(ツ)_/¯


samth
2017-2-22 22:59:23

@greg which GH issue?


samth
2017-2-22 22:59:37

and yes, this is something I want a lot


samth
2017-2-22 23:00:10

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


lexi.lambda
2017-2-22 23:01:47

samth
2017-2-22 23:09:56

ah that


greg
2017-2-22 23:18:24

@lexi.lambda maybe? :smile:


githree
2017-2-22 23:51:07

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!


leif
2017-2-22 23:53:33

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


leif
2017-2-22 23:54:06

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


leif
2017-2-22 23:54:13

SOmething like hello@superscript{world}?


githree
2017-2-23 00:20:05

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


mflatt
2017-2-23 00:52:21

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


leif
2017-2-23 02:41:24

@githree lol, nice.


leif
2017-2-23 02:41:29

@mflatt Ah, okay, thanks.