[racket-users] GUI executable creating an annoying command line window

2020-05-26 Thread Philip Benade
Hi All

I have been trying to create a simple GUI with the racket/gui library. For 
the most part it works but alongside my GUI it also creates a command line 
window. You can see a screenshot of this in the attached picture. I found 
this discussion when I searched for a solution: 
https://groups.google.com/forum/#!topic/racket-users/QmvqWtm1x28 In that 
case it was happening because there were things that did not return void. 
In my case however it is not printing anything, there isn't even any white 
space.

I am using the "Create Executable" option from the "Racket" heading in 
Dr.Racket's menu. I set the Type to be "Distribution (to install on other 
machines)" and the Base to "GRacket" and keep the "Embed DLLs in the 
executable" check box checked. Is there some setting or something I can 
change to make this window to go away?

I have attached my program's .rtk file in case anyone needs it to see what 
I'm doing wrong.

Regards
Philip

-- 
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/3387d77b-e9a6-4777-a46b-ac897596702e%40googlegroups.com.


work-timer.rkt
Description: Binary data


Re: [racket-users] GUI executable creating an annoying command line window

2020-05-26 Thread Laurent
Does it change anything if you use #lang racket/gui instead of #lang racket
(require racket/gui)?

On Tue, May 26, 2020 at 10:00 AM Philip Benade 
wrote:

> Hi All
>
> I have been trying to create a simple GUI with the racket/gui library. For
> the most part it works but alongside my GUI it also creates a command line
> window. You can see a screenshot of this in the attached picture. I found
> this discussion when I searched for a solution:
> https://groups.google.com/forum/#!topic/racket-users/QmvqWtm1x28 In that
> case it was happening because there were things that did not return void.
> In my case however it is not printing anything, there isn't even any white
> space.
>
> I am using the "Create Executable" option from the "Racket" heading in
> Dr.Racket's menu. I set the Type to be "Distribution (to install on other
> machines)" and the Base to "GRacket" and keep the "Embed DLLs in the
> executable" check box checked. Is there some setting or something I can
> change to make this window to go away?
>
> I have attached my program's .rtk file in case anyone needs it to see what
> I'm doing wrong.
>
> Regards
> Philip
>
> --
> 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/3387d77b-e9a6-4777-a46b-ac897596702e%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/CABNTSaG8MPUg7wWCe%2BGyROFnDCM9KoJ8A6eUujXYhUR1QC1y6g%40mail.gmail.com.


[racket-users] Re: GUI executable creating an annoying command line window

2020-05-26 Thread Alex Harsanyi

I cannot reproduce this.  If I create the executable from the command line 
using "raco exe --gui work-timer.rkt", or from DrRacket specifying GRacket 
as the "base", the console window does not show up.  

If I create the executable using "raco exe work-timer.rkt" or by specifying 
"Racket" as the base in DrRacket, the console window shows up, but this is 
expected.

I am using Racket 7.7 (BC, not the Chez version).

Alex.

On Tuesday, May 26, 2020 at 5:00:01 PM UTC+8, Philip Benade wrote:
>
> Hi All
>
> I have been trying to create a simple GUI with the racket/gui library. For 
> the most part it works but alongside my GUI it also creates a command line 
> window. You can see a screenshot of this in the attached picture. I found 
> this discussion when I searched for a solution: 
> https://groups.google.com/forum/#!topic/racket-users/QmvqWtm1x28 In that 
> case it was happening because there were things that did not return void. 
> In my case however it is not printing anything, there isn't even any white 
> space.
>
> I am using the "Create Executable" option from the "Racket" heading in 
> Dr.Racket's menu. I set the Type to be "Distribution (to install on other 
> machines)" and the Base to "GRacket" and keep the "Embed DLLs in the 
> executable" check box checked. Is there some setting or something I can 
> change to make this window to go away?
>
> I have attached my program's .rtk file in case anyone needs it to see what 
> I'm doing wrong.
>
> Regards
> Philip
>

-- 
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/2bcb57b6-73c4-41cb-b737-64d0cb0cf31e%40googlegroups.com.


Re: [racket-users] GUI executable creating an annoying command line window

2020-05-26 Thread Philip Benade
Hi Laurent

Unfortunately no, nothing changes.

Regards
Philip

On Tuesday, 26 May 2020 11:47:28 UTC+2, Laurent wrote:
>
> Does it change anything if you use #lang racket/gui instead of #lang 
> racket (require racket/gui)?
>
> On Tue, May 26, 2020 at 10:00 AM Philip Benade  > wrote:
>
>> Hi All
>>
>> I have been trying to create a simple GUI with the racket/gui library. 
>> For the most part it works but alongside my GUI it also creates a command 
>> line window. You can see a screenshot of this in the attached picture. I 
>> found this discussion when I searched for a solution: 
>> https://groups.google.com/forum/#!topic/racket-users/QmvqWtm1x28 In that 
>> case it was happening because there were things that did not return void. 
>> In my case however it is not printing anything, there isn't even any white 
>> space.
>>
>> I am using the "Create Executable" option from the "Racket" heading in 
>> Dr.Racket's menu. I set the Type to be "Distribution (to install on other 
>> machines)" and the Base to "GRacket" and keep the "Embed DLLs in the 
>> executable" check box checked. Is there some setting or something I can 
>> change to make this window to go away?
>>
>> I have attached my program's .rtk file in case anyone needs it to see 
>> what I'm doing wrong.
>>
>> Regards
>> Philip
>>
>> -- 
>> 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...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/racket-users/3387d77b-e9a6-4777-a46b-ac897596702e%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/4dd78be7-8f09-44d8-bd63-73debd4b5294%40googlegroups.com.


[racket-users] Re: GUI executable creating an annoying command line window

2020-05-26 Thread Philip Benade
Hi Alex

I managed to get it working. Updating Dr.Racket to 7.7 did the trick. I 
should have thought of it sooner, but I became so wrapped up in looking for 
the problem in my code I didn't think of it.

Thank you for your help.

Regards
Philip

On Tuesday, 26 May 2020 11:50:58 UTC+2, Alex Harsanyi wrote:
>
>
> I cannot reproduce this.  If I create the executable from the command line 
> using "raco exe --gui work-timer.rkt", or from DrRacket specifying GRacket 
> as the "base", the console window does not show up.  
>
> If I create the executable using "raco exe work-timer.rkt" or by 
> specifying "Racket" as the base in DrRacket, the console window shows up, 
> but this is expected.
>
> I am using Racket 7.7 (BC, not the Chez version).
>
> Alex.
>
> On Tuesday, May 26, 2020 at 5:00:01 PM UTC+8, Philip Benade wrote:
>>
>> Hi All
>>
>> I have been trying to create a simple GUI with the racket/gui library. 
>> For the most part it works but alongside my GUI it also creates a command 
>> line window. You can see a screenshot of this in the attached picture. I 
>> found this discussion when I searched for a solution: 
>> https://groups.google.com/forum/#!topic/racket-users/QmvqWtm1x28 In that 
>> case it was happening because there were things that did not return void. 
>> In my case however it is not printing anything, there isn't even any white 
>> space.
>>
>> I am using the "Create Executable" option from the "Racket" heading in 
>> Dr.Racket's menu. I set the Type to be "Distribution (to install on other 
>> machines)" and the Base to "GRacket" and keep the "Embed DLLs in the 
>> executable" check box checked. Is there some setting or something I can 
>> change to make this window to go away?
>>
>> I have attached my program's .rtk file in case anyone needs it to see 
>> what I'm doing wrong.
>>
>> Regards
>> Philip
>>
>

-- 
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/40774e6e-7b89-4cd2-a21a-f1a936783c94%40googlegroups.com.


Re: [racket-users] Sandbox + 2htdp/image

2020-05-26 Thread Robby Findler
It might be easiest to just use the `image?` predicate from inside the
sandbox. Get it out the same way you got the image itself out.

Robby


On Tue, May 26, 2020 at 6:22 PM Stephen Foster 
wrote:

> The following returns #f and #t.  How can I get it to return #t and #t?
>
> Context: I want to allow students to run Racket code on my server. But
> when I sandbox their code, I am getting back something that doesn't behave
> like a 2htdp/image object.  I'm not exactly sure what it is.
>
> #lang racket
>
> (require racket/sandbox 2htdp/image)
>
> (sandbox-path-permissions
>   (list
> '(exists
>"/usr/lib/ssl/cert.pem")
> '(exists
>"/usr/lib/ssl/certs")))
>
> (define user-code '(circle 40 'solid 'red))
>
> (define circle1
>   ((make-evaluator 'racket
>`(define f
>   (let ()
> ,user-code))
>#:requires
>'(2htdp/image))
>'f))
>
> (define circle2
>   (circle 40 'solid 'red))
>
> (image? circle1) ;#f but I want it to be #t
> (image? circle2) ;#t
>
>
> If it helps, when I print out the above values with ~a, I get:
>
> "#(struct:object:image% ... #(struct:translate 40 40 #(struct:ellipse 80
> 80 0 255 red)) #(struct:bb 80 80 80) #f #f #f #f #t)"
>
> "#(struct:object:image% ...)"
>
> --
> 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/ebf8bf84-23d6-45f3-9b1d-6bb6bf592b8e%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/CAL3TdOP%3Diwf5PvNk6myn1i4b0qvgx2mC82m2GLKavPqQTxcVaw%40mail.gmail.com.


[racket-users] Sandbox + 2htdp/image

2020-05-26 Thread Stephen Foster
The following returns #f and #t.  How can I get it to return #t and #t?

Context: I want to allow students to run Racket code on my server. But when 
I sandbox their code, I am getting back something that doesn't behave like 
a 2htdp/image object.  I'm not exactly sure what it is. 

#lang racket

(require racket/sandbox 2htdp/image)

(sandbox-path-permissions
  (list
'(exists
   "/usr/lib/ssl/cert.pem")
'(exists
   "/usr/lib/ssl/certs")))

(define user-code '(circle 40 'solid 'red))

(define circle1
  ((make-evaluator 'racket
   `(define f
  (let ()
,user-code))
   #:requires
   '(2htdp/image))
   'f))

(define circle2
  (circle 40 'solid 'red))

(image? circle1) ;#f but I want it to be #t
(image? circle2) ;#t


If it helps, when I print out the above values with ~a, I get:

"#(struct:object:image% ... #(struct:translate 40 40 #(struct:ellipse 80 80 
0 255 red)) #(struct:bb 80 80 80) #f #f #f #f #t)"

"#(struct:object:image% ...)"

-- 
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/ebf8bf84-23d6-45f3-9b1d-6bb6bf592b8e%40googlegroups.com.


[racket-users] pkgs.racket-lang.org Why are the links so inconsistent?

2020-05-26 Thread Simon Schlee
Hello,

searching through a bunch of different packages I noticed that the 
code/download links are quite inconsistent.

For some packages there is a download button clicking that button does 
nothing (in firefox) because it contains a git:// protocol url, here is an 
example package:
https://pkgs.racket-lang.org/package/pict-lib

But in the bottom table there is the row "Version exceptions" that uses the 
git protocol in the link text but a https protocol in the actual link.

What is the reason that the download button at the top uses the git 
protocol?
I would have expected https.

Why is it a download button? 
It could be a source button with the https address from the bottom.


I know that within the package preferences/edit-form it is possible to 
choose between simple url and git repository.
I suspect that the differences in the buttons that are shown for that 
package result from these different modes.

I think that it would be more user friendly to show the code button (with 
https address to github/gitlab/etc) for as many packages as possible,
this way you can easily get to the git repository of most packages. 
It is frustrating when packages that have a github repo are linked to with 
the git protocol, resulting in a download button that does nothing.

There are packages which aren't git repositories and for those it makes 
sense that there is only a download button, but no source button.


If the download button with git protocol is useful for some people (because 
they have taught their browser to open a git viewer application or 
something like that),
then it would make sense to have both buttons.

When I am on the documentation page and I click the package link I get to 
the package detail page, 
for many packages I can then click a second time on the code or download 
button and get to a website where I can explore the code without needing to 
download it.
When this works, it is excellent.
When it does not, it is frustrating.


Simon

-- 
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/cb8504c8-0fc2-4780-bf72-e6fec120e8a7%40googlegroups.com.


Re: [racket-users] Migrating from a "model-driven" language framework to Racket

2020-05-26 Thread Sam Tobin-Hochstadt
I think the best way to implement what you describe for a "better
version" is as follows:

Expand `(instance h1 half-adder-arch)` into something like

  (define-syntax h1 (half-adder-arch-info))

Where `half-adder-arch-info` is an expansion-time structure describing
half-adders.
Then the `assign` macro can use `syntax-local-value` to get out that
information, see that it's a half-adder, and then generate the code
you've written manually.

This paper: https://arxiv.org/abs/1106.2578 talks about this technique
in more detail, focused on the implementation of `match-expander`s,
which work this way, but it's a common Racket technique and used for
structs, syntax classes, `for` transformers, and more.

Sam

  (

On Tue, May 26, 2020 at 3:08 PM Guillaume Savaton
 wrote:
>
> Le mardi 26 mai 2020 03:59:59 UTC+2, johnbclements a écrit :
>>
>> > So far, I have made two attempts to work around these issues: (1) by 
>> > creating a metamodel-like data structure using Racket structs, and 
>> > transforming syntax objects into struct instances; or (2) using syntax 
>> > objects only and attaching context data to each of them as a syntax 
>> > property.
>> > Both have strengths and weaknesses, and I am still feeling that I am not 
>> > using Racket with the right mindset.
>>
>> I think your (2) sounds like a lighter-weight solution. However, it 
>> definitely does seem as though much of the difficulty here is related to the 
>> differences between a more imperative and a more functional style.
>
>
> I'm not sure that solution (2) is lighter. Maybe the weight is moved to 
> another part of the implementation :)
>
> I have set up an example at this address: 
> https://gist.github.com/senshu/c6db95615b4b2567f168d6bfbe61655e
>
> It is basically a very stripped-down hardware description language that 
> borrows from VHDL and Verilog.
> Like VHDL, the description of a circuit is split into an "entity" (the 
> interface of the circuit) and an "architecture" (the implementation).
> For the sake of simplicity, this example does not implement a complete model 
> of computation.
>
> The file "tiny-hdl-example-v1.rkt" implements a full adder and prints its 
> truth table.
> At this point, there is no name resolution, so I need to give redundant 
> information in the "port-ref" expressions.
> A better version of the language would allow to write:
>
> (assign (h1 a) a)
>
> instead of:
>
> (assign (port-ref half-adder h1 a) (port-ref full-adder a))
>
> because we know that
>
> h1 is an instance of half-adder-arch, that has the entity half-adder,
> the current architecture is full-adder-arch and its entity is full-adder
>
> I hope it clarifies my current concerns.
>
> Guillaume
>
> --
> 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/a42ec2de-6441-483f-a05a-910c03c317e8%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/CAK%3DHD%2BYs2_w3JtDb5mDDWOtqswXjcGo34hVmHiucDUihnZbbWw%40mail.gmail.com.


Re: [racket-users] Migrating from a "model-driven" language framework to Racket

2020-05-26 Thread Guillaume Savaton
Le mardi 26 mai 2020 21:41:14 UTC+2, Sam Tobin-Hochstadt a écrit :
>
> I think the best way to implement what you describe for a "better 
> version" is as follows: 
>
> Expand `(instance h1 half-adder-arch)` into something like 
>
>   (define-syntax h1 (half-adder-arch-info)) 
>

I have seen this done somewhere else.
At the time, I found that it looked more like a hack to work around the 
limitations of syntax objects (compared to the model-drive approach).

But I also understand that it can be a flexible way to organize the 
expansion-time data that we need without creating a complete object graph.
I will have a closer look at this pattern.

This paper: https://arxiv.org/abs/1106.2578 talks about this technique 
> in more detail, focused on the implementation of `match-expander`s, 
> which work this way, but it's a common Racket technique and used for 
> structs, syntax classes, `for` transformers, and more. 
>

Thanks for the reference.
I will have a look at it in the next few days.

Guillaume

-- 
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/db346484-27a5-493a-872b-835207595211%40googlegroups.com.


Re: [racket-users] Migrating from a "model-driven" language framework to Racket

2020-05-26 Thread 'John Clements' via Racket Users
Okay, I could just be putting my foot in my mouth, here, but it sounds like 
you’re describing the kinds of things that are typically done by a 
type-checker. Have you considered adding a type-checking pass? It would contain 
an environment that maps names like “h1” to “types” that indicate that h1 is an 
instance of half-adder-arch.

In your case, the type checker would also be “resolving” lightweight 
expressions like (assign (h1 a) a) into fully-decorated expressions like 
(assign (port-ref half-adder h1 a) (port-ref full-adder a)) .

Does this make sense?

John


> On May 26, 2020, at 12:08 PM, Guillaume Savaton  
> wrote:
> 
> Le mardi 26 mai 2020 03:59:59 UTC+2, johnbclements a écrit :
> > So far, I have made two attempts to work around these issues: (1) by 
> > creating a metamodel-like data structure using Racket structs, and 
> > transforming syntax objects into struct instances; or (2) using syntax 
> > objects only and attaching context data to each of them as a syntax 
> > property. 
> > Both have strengths and weaknesses, and I am still feeling that I am not 
> > using Racket with the right mindset. 
> 
> I think your (2) sounds like a lighter-weight solution. However, it 
> definitely does seem as though much of the difficulty here is related to the 
> differences between a more imperative and a more functional style.
> 
> I'm not sure that solution (2) is lighter. Maybe the weight is moved to 
> another part of the implementation :)
> 
> I have set up an example at this address: 
> https://gist.github.com/senshu/c6db95615b4b2567f168d6bfbe61655e
> 
> It is basically a very stripped-down hardware description language that 
> borrows from VHDL and Verilog.
> Like VHDL, the description of a circuit is split into an "entity" (the 
> interface of the circuit) and an "architecture" (the implementation).
> For the sake of simplicity, this example does not implement a complete model 
> of computation.
> 
> The file "tiny-hdl-example-v1.rkt" implements a full adder and prints its 
> truth table.
> At this point, there is no name resolution, so I need to give redundant 
> information in the "port-ref" expressions.
> A better version of the language would allow to write:
> 
> (assign (h1 a) a)
> 
> instead of:
> 
> (assign (port-ref half-adder h1 a) (port-ref full-adder a))
> 
> because we know that
>   • h1 is an instance of half-adder-arch, that has the entity half-adder,
>   • the current architecture is full-adder-arch and its entity is 
> full-adder
> I hope it clarifies my current concerns.
> 
> Guillaume
> 
> -- 
> 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/a42ec2de-6441-483f-a05a-910c03c317e8%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/d7263942-5e70-49ac-977e-9d8a2471389c%40mtasv.net.


Re: [racket-users] Migrating from a "model-driven" language framework to Racket

2020-05-26 Thread Guillaume Savaton
Le mardi 26 mai 2020 03:59:59 UTC+2, johnbclements a écrit :
>
> > So far, I have made two attempts to work around these issues: (1) by 
> creating a metamodel-like data structure using Racket structs, and 
> transforming syntax objects into struct instances; or (2) using syntax 
> objects only and attaching context data to each of them as a syntax 
> property. 
> > Both have strengths and weaknesses, and I am still feeling that I am not 
> using Racket with the right mindset. 
>
> I think your (2) sounds like a lighter-weight solution. However, it 
> definitely does seem as though much of the difficulty here is related to 
> the differences between a more imperative and a more functional style.
>

I'm not sure that solution (2) is lighter. Maybe the weight is moved to 
another part of the implementation :)

I have set up an example at this address: 
https://gist.github.com/senshu/c6db95615b4b2567f168d6bfbe61655e

It is basically a very stripped-down hardware description language that 
borrows from VHDL and Verilog.
Like VHDL, the description of a circuit is split into an "entity" (the 
interface of the circuit) and an "architecture" (the implementation).
For the sake of simplicity, this example does not implement a complete 
model of computation.

The file "tiny-hdl-example-v1.rkt" implements a full adder and prints its 
truth table.
At this point, there is no name resolution, so I need to give redundant 
information in the "port-ref" expressions.
A better version of the language would allow to write:

(assign (h1 a) a)

instead of:

(assign (port-ref half-adder h1 a) (port-ref full-adder a))

because we know that

   - h1 is an instance of half-adder-arch, that has the entity half-adder,
   - the current architecture is full-adder-arch and its entity is 
   full-adder

I hope it clarifies my current concerns.

Guillaume

-- 
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/a42ec2de-6441-483f-a05a-910c03c317e8%40googlegroups.com.


Re: [racket-users] Migrating from a "model-driven" language framework to Racket

2020-05-26 Thread Guillaume Savaton
Le mardi 26 mai 2020 21:45:21 UTC+2, johnbclements a écrit :
>
> In your case, the type checker would also be “resolving” lightweight 
> expressions like (assign (h1 a) a) into fully-decorated expressions like 
> (assign (port-ref half-adder h1 a) (port-ref full-adder a)) . 
> Does this make sense? 
>

Totally.
I have been browsing the Mini-Java example that was published for the 2016 
Language Workbench Challenge, and this "decoration" phase happens in the 
typechecker module.
https://github.com/dfeltey/lwc2016/tree/master/mini-java

I have added two files to the gist at 
https://gist.github.com/senshu/c6db95615b4b2567f168d6bfbe61655e

   - tiny-hdl-resolver.rkt implements the name resolution phase. It is 
   freely inspired by what I found in the Mini-Java sources.
   - tiny-hdl-example-v2.rkt is an updated example where the redundant 
   information has been removed.

This small language still needs some semantic checking:

   - An output port must be written exactly once in a given architecture.
   - An input port cannot be assigned.

-- 
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/93ea3922-acfb-46fa-88fd-9eea021c62b3%40googlegroups.com.


Re: [racket-users] Testing for Packages

2020-05-26 Thread Alexis King
> On May 26, 2020, at 21:36, Robert Postill  wrote:
> 
> One thing that troubled me was that the tests seemed to be dependant on the 
> package already being installed.

I think this is very common within the Racket ecosystem. I would guess that 
very few packages are consciously designed to be “relocatable” in the way you 
describe.

> I've always considered the point at which a package gets transferred into the 
> domain of raco pkg's management to be a pivotal moment. It has this implied 
> social contract that if I'm mixing with code into a system area managed by 
> the language, the package needs to be trustworthy. Testing *after* installing 
> seems a bit like I'm putting the cart before the horse?

I cannot speak to the cultural norms of the Ruby community, as I am not 
terribly familiar with them, but I will admit that I find this mentality 
somewhat curious. In Racket, “installing” a package doesn’t affect very much 
beyond module path resolution. Running a package’s tests can do all the same 
things—install a keylogger, steal your private key, encrypt your hard 
drive—whether it is installed or not. Installation is also not very permanent; 
it’s very easy to undo or change.

So from my perspective, going out of your way to download package code and run 
it without officially installing it via `raco pkg` seems like a mostly 
pointless exercise. You’re basically doing all the same things—downloading it, 
unpacking it to a particular location on your computer, and giving it all the 
privileges of the user you run it as—just manually, rather than letting raco do 
the work for you. It is entirely possible that there is some additional 
distinction or utility I am not seeing, but my first instinct is to recommend 
that you just install the package. You can always uninstall it.

Alexis

-- 
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/2134D9EC-8870-4181-9BEF-2BEC6971ADEC%40gmail.com.


[racket-users] Testing for Packages

2020-05-26 Thread Robert Postill
Hi, 

Inspired by the reply to 
https://stackoverflow.com/questions/62014612/how-to-test-a-racket-package-self-sufficiently,
 I 
decided to ask the question here.  So a little background to the 
discussion.  I've been looking at a racket package, and the package has a 
couple of collections.  It's been dormant for a few years, and so when I 
ran the tests they didn't work (it's a driver, and the database it works 
with had moved on in the intervening time).  So I started thinking about 
the tests.  One thing that troubled me was that the tests seemed to be 
dependant on the package already being installed. Ryan Culpepper's comment 
on the stack overflow question (https://stackoverflow.com/a/62027185/11219) 
suggests that the tests should be run once the package is under raco pkg's 
management. Up until that point, I had been considering a PR rewiring the 
require statements to be significantly more relative.

In the generally excellent docs for racket, I haven't found advice relating 
to the right way to structure the tests for a package. Nor an idiomatic 
approach to dealing with package installation during package development. 
Here are my sources for reference:
https://blog.racket-lang.org/2017/10/tutorial-creating-a-package.html
https://beautifulracket.com/jsonic-3/the-package-server.html
https://greghendershott.com/2013/12/racket-package-management.html
http://www.greghendershott.com/2017/04/racket-makefiles.html

Now I think I should explain why I'm thinking that way.  FYI I've been a 
part of the ruby community, and so my thinking has a ruby-ish colour.  
Which makes me think I'm maybe off in my community norms for racket. I've 
always considered the point at which a package gets transferred into the 
domain of raco pkg's management to be a pivotal moment. It has this implied 
social contract that if I'm mixing with code into a system area managed by 
the language, the package needs to be trustworthy. Testing *after* 
installing seems a bit like I'm putting the cart before the horse? It feels 
like saying here's my code, put it in a system-wide place, I hope it works.

So I'm interested in opinions and advice as to how to think correctly about 
testing packages and also how other people approach creating a well-behaved 
package.

Regards
Robert

-- 
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/3c76b368-705e-43c4-a83d-843da3f596ec%40googlegroups.com.


[racket-users] Re: Testing for Packages

2020-05-26 Thread Alex Harsanyi

I am personally confused about what you think the problem is, so I just 
want to make sure that you know that you can develop and test a new 
package, or you can modify an existing package and test the modifications, 
without publishing the package.

Basically in Racket you can:

* create a new package using "raco pkg new", or clone an existing one
* install the package from the local folder, using "raco pkg install 
./my-package"
* make changes and run the tests -- you can keep making changes on the 
installed package without having to re-install it
* once the tests pass, you can commit the changes and publish them

"Under raco pkg management" does not mean that the package is publicly 
available on the racket package server.  You can keep the package private, 
and still be able to install it and run the tests.

Alex.

On Wednesday, May 27, 2020 at 10:36:10 AM UTC+8, Robert Postill wrote:
>
> Hi, 
>
> Inspired by the reply to 
> https://stackoverflow.com/questions/62014612/how-to-test-a-racket-package-self-sufficiently,
>  I 
> decided to ask the question here.  So a little background to the 
> discussion.  I've been looking at a racket package, and the package has a 
> couple of collections.  It's been dormant for a few years, and so when I 
> ran the tests they didn't work (it's a driver, and the database it works 
> with had moved on in the intervening time).  So I started thinking about 
> the tests.  One thing that troubled me was that the tests seemed to be 
> dependant on the package already being installed. Ryan Culpepper's 
> comment on the stack overflow question (
> https://stackoverflow.com/a/62027185/11219) suggests that the tests 
> should be run once the package is under raco pkg's management. Up until 
> that point, I had been considering a PR rewiring the require statements to 
> be significantly more relative.
>
> In the generally excellent docs for racket, I haven't found advice 
> relating to the right way to structure the tests for a package. Nor an 
> idiomatic approach to dealing with package installation during package 
> development. Here are my sources for reference:
> https://blog.racket-lang.org/2017/10/tutorial-creating-a-package.html
> https://beautifulracket.com/jsonic-3/the-package-server.html
> https://greghendershott.com/2013/12/racket-package-management.html
> http://www.greghendershott.com/2017/04/racket-makefiles.html
>
> Now I think I should explain why I'm thinking that way.  FYI I've been a 
> part of the ruby community, and so my thinking has a ruby-ish colour.  
> Which makes me think I'm maybe off in my community norms for racket. I've 
> always considered the point at which a package gets transferred into the 
> domain of raco pkg's management to be a pivotal moment. It has this implied 
> social contract that if I'm mixing with code into a system area managed by 
> the language, the package needs to be trustworthy. Testing *after* 
> installing seems a bit like I'm putting the cart before the horse? It feels 
> like saying here's my code, put it in a system-wide place, I hope it works.
>
> So I'm interested in opinions and advice as to how to think correctly 
> about testing packages and also how other people approach creating a 
> well-behaved package.
>
> Regards
> Robert
>

-- 
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/aca8e24c-88db-4aae-8ab6-4dc455b4481f%40googlegroups.com.