Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handin loses language info on submit #17

Open
albertxing opened this issue Mar 5, 2015 · 3 comments
Open

Handin loses language info on submit #17

albertxing opened this issue Mar 5, 2015 · 3 comments

Comments

@albertxing
Copy link

When a student submits a file, the language is reset - the three metadata lines that DrRacket inserts are not sent to the server. This is particularly annoying since our course sends out grading packages, and the graders currently have to manually set the language for each submission (we use the HTDP languages)

One potential fix that I've tested is to save the definitions text to a temporary file, then read from the temporary file. This is more of a workaround since there's no way to save to a byte string instead of a file.

I can submit a rough patch for this, but I suspect this might be a wontfix. Thoughts?

@Blaisorblade
Copy link
Contributor

Hi, I'm another user with the same problem. Can you share your rough patch, in case your work helps anybody? For instance, I'm currently taking a look at this problem, but I'm not a Racket expert so I need all the help I can get 😉

@Blaisorblade
Copy link
Contributor

OK, I might have a better idea.

I've found out how HTDP defines those lines: it overrides (in this code) the language's get-metadata method. By hacking my way around (and not even so much), I ended-up with the following stuff which seems to be working (enable BSL and run it in the interactions window). Instead of "fooXXX", one needs the module name (that is, the file name?).

I'll next try and add this to the actual handin client.

(require drracket/tool-lib)
(require framework/preferences)
(define pref (preferences:get (drracket:language-configuration:get-settings-preferences-symbol)))
(define lang (drracket:language-configuration:language-settings-language pref))
(define settings (drracket:language-configuration:language-settings-settings pref))
> (send lang get-metadata "fooXXX" settings)
";; The first three lines of this file were inserted by DrRacket. They record metadata\n;; about the language level of this file in a form that our tools can easily process.\n#reader(lib \"htdp-beginner-reader.ss\" \"lang\")((modname \"fooXXX\") (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f () #f)))\n"

Blaisorblade added a commit to ps-tuebingen/handin that referenced this issue Sep 7, 2015
Network transmission and editor concatenation are implemented following
the specs (with question marks), but this is still untested, so there
are zero chances it already works - take it as a prototype.
Blaisorblade added a commit to ps-tuebingen/handin that referenced this issue Sep 9, 2015
Network transmission and editor concatenation are implemented following
the specs (with question marks), but this is still untested, so there
are zero chances it already works - take it as a prototype.
@Blaisorblade
Copy link
Contributor

I got this to work for me (at least for the first test). More testing is needed, but it's progress.

I had to update a checker though, to accept the language annotation and specify the right language the same way it is sent. But the impact is limited:

diff --git a/01-draw-a-picture/checker.rkt b/01-draw-a-picture/checker.rkt
index 1a6adea..74765e8 100644
--- a/01-draw-a-picture/checker.rkt
+++ b/01-draw-a-picture/checker.rkt
@@ -4,7 +4,7 @@
   (define (error* fmt . args)
     (raise-user-error (apply format fmt args)))

-  (check: :language 'lang/htdp-beginner
+  (check: :language '(module (lib "htdp-beginner.ss" "lang"))
           :requires '(2htdp/image)
           :users (lambda (users) (values))
           :create-text? #f

Blaisorblade added a commit to ps-tuebingen/handin that referenced this issue Sep 10, 2015
Fix racket#17 by loading the language metadata from the DrRacket
configuration and prepending it to a clone of the definitions editor
before serializing this clone.

Warning: This hard-codes the module name to `'handin`, which doesn't
sound very good.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants