Re: [racket-users] trickiness about the order of definitions in GUI code

2020-05-06 Thread Philip McGrath
On Wed, May 6, 2020 at 8:49 PM Jon Zeppieri  wrote:

> It's a bit trickier to define these things in separate files, because
> their definitions refer to each other (though indirectly in this
> case), and the module system does not tolerate cyclic dependencies.
> The most straightforward way to break the cycle would be to take
> advantage of the fact that `table3` and `info-menu-item` each depends
> on `row-edit-menu`, and `info-menu-item` further depends on `table3`,
> but `row-edit-menu` doesn't depend on either. So the dependencies
> aren't really cyclical.
>

When possible, finding ways to avoid cyclic dependencies in the first place
is definitely advisable: even if you can get Racket to understand them,
mere human beings may find them confusing.

But sometimes there really are entanglements between units of code that you
want to logically separate: then, as Alex said, you need an indirection.
For a relatively simple case, a simple solution using familiar constructs
(like `lambda`) is the right choice, but complicated cycles seem to turn up
especially often in complicated, large-scale code.

Rather than designing an ad hoc system of indirection that can handle all
of the complexity,* I suggest using the one that already exists: units
, Racket's original,
first-class (rather than first-order) module system, offer support for
cyclic dependencies. In fact, they are used in the implementation of
Racket's GUI framework to address precisely this problem.

For this example it ends up being a bit contrived (I would probably use
`class` to define a `row-edit-menu%` that takes a table as an
initialization argument), but here's a way of writing it in a single file
using units: I've posted a Gist

showing the division into multiple files, which is straight-forward.

#lang racket/gui
>
> (require qresults-list)
>
> ;; A signatures describes an interface.
>
> (define-signature row-edit-menu^
>   (row-edit-menu))
>
> (define-signature table3^
>   (table3))
>
> (define-signature frame3^ extends table3^
>   (frame3))
>
> ;; A unit that exports a signature must
> ;; implement the definitions it specifies.
>
> ;; Units can also import signatures,
> ;; which allows the body of the unit to
> ;; refer to definitions from the imported signatures.
> ;; Before the unit is invoked,
> ;; it must be linked together with other units
> ;; that that export the signatures it imports,
> ;; which will suply the actual implementations.
>
> ;; Code in the body of the unit is run when the unit is invoked.
>
> (define-unit row-edit-menu@
>   (import table3^)
>   (export row-edit-menu^)
>
>   (define row-edit-menu
> (new popup-menu%))
>
>   (define info-menu-item
> (new menu-item%
>  [label "info"]
>  [parent row-edit-menu]
>  [callback
>   (λ (menu-item event)
> (define num-selected
>   (length (send table3 get-selected-row-indexes)))
> (message-box "Info"
>  (~a "You have selected " num-selected " rows")
>  #f))])))
>
>
> (define-unit table3@
>   (import row-edit-menu^)
>   (export frame3^)
>
>   (init-depend row-edit-menu^)
>
>   (define frame3
> (new frame%
>  [label "myTable 3"]
>  [width 800]
>  [height 600]))
>
>   (define table3
> (new (class qresults-list%
>(super-new))
>  [parent frame3]
>  [pref-tag 'preferences-tag]
>  [selection-type 'multiple]
>  [right-click-menu row-edit-menu])))
>
>
> ;; Invoke the units and introduce the definitions they
> ;; export into this scope:
>
> (define-values/invoke-unit/infer
>   (link row-edit-menu@
> table3@))
>
> ;; Run the demo:
>
> (send table3
>   setup-column-defs
>   (let ([column1
>  (λ (data) (vector-ref data 0))]
> [column2
>  (λ (data) (vector-ref data 1))])
> (list (qcolumn "Column1" column1 column1)
>   (qcolumn "Column2"
>(λ (row)
>  ;; allows a cell to be blank
>  (if (number? (column2 row))
>  (number->string (column2 row))
>  ""))
>column2
>
> (send table3 add-row (vector "R1C1" 10))
> (send table3 add-row (vector "R2C1" 11))
> (send table3 add-row (vector "R3C1" 12))
> (send table3 add-row (vector "R4C1" 13))
>
> (send frame3 show #t)
>

* Even when specific requirements eventually led me to implement my own
system, as I discussed a bit in my RacketCon talk, it helped to have used
units and looked at a bit of their implementation. I still do use units in
other parts of the Digital Ricoeur codebase.

-Philip

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group 

Re: [racket-users] Re: trickiness about the order of definitions in GUI code

2020-05-06 Thread James Platt
Thanks, Alex.  I actually tried something very similar to this earlier but 
failed.  What I should have done is to try it with my simplified code and then 
I would have realized it was an approach that could work.  The complication is 
that there is much more stuff going on in my production code.  For example, the 
popup menu is defined with a demand-callback function to enable and disable 
menu items, so that something which operates on a selection will be grayed out 
if there is no selection.  This also depends on the table definition.  I'll try 
and figure out how to make that work but, like you said, it's just a matter of 
more indirection.

James


On May 6, 2020, at 9:27 PM, Alex Harsanyi wrote:

> Every problem can be solved by adding another level of indirection (except 
> perhaps having too many  levels of indirection :-) ).  You can put the code 
> below in a separate file:
> 
> (define (make-info-menu-item parent target-table)
>   (new menu-item%
>   (label "info")
>   (parent parent)
>   (callback (lambda (menu-item event)
>   (message-box "Info"
>(~a "You have selected " (length (send target-table 
> get-selected-row-indexes)) " rows")
>#f)
> 
> And use it like so:
> 
> (require "info-menu-item.rkt")
> (define row-edit-menu (new popup-menu% ))
> (define table3 ...)
> (define info-menu (make-info-menu-item row-edit-menu table3)
> 
> You could also have just one "make-row-edit-menu" function which creates all 
> menu items.
> 
> Alex.
> 
> On Thursday, May 7, 2020 at 7:50:01 AM UTC+8, James Platt wrote:
> I'm working on organizing and documenting some things and I have some code, 
> below, which works but I don't understand why.  Specifically, why don't I get 
> an error about table3 not being defined? 
> 
> This is a very simplified version of what I'm working on.  What I actually 
> want to do is put all the code related to creating a standard table editing 
> menu in a file which I can then include wherever I want that menu.  The full 
> menu will be a lot of code.  Unfortunately I can't seem to get this to work 
> without either getting an error that row-edit-menu is not defined or that 
> table3 is not defined.  In other words, I want to be able to define table3 in 
> one file which requires the file where row-edit-menu is defined but I can't 
> seem to figure out how to get this to work.  It works just fine when all the 
> code is in one file, however. 
> 
> James 
> 
> 
> #lang racket 
> (require racket/gui/base 
>  qresults-list 
>  ) 
> 
> ;set up columns 
> (define (column1 data) (vector-ref data 0)) 
> (define (column2 data) (vector-ref data 1)) 
> 
> (define my-columns 
>   (list 
>(qcolumn "Column1" column1 column1) 
>(qcolumn "Column2" 
> (lambda (row) 
>   ;(displayln row) 
>   ;(displayln (db-row-ref row "Column2" headers 1)) 
>   (if (number? (column2 row)) (number->string (column2 row)) 
> "");This allows a cell to be blank. 
>   ;(number->string (column2 row)) 
>   ) 
> column2) 
> 
>) 
>   ) 
> 
> (define frame3 (new frame% 
>   [label "myTable 3"] 
>   [width 800] 
>   [height 600] 
>   )) 
> 
> 
> (define row-edit-menu (new popup-menu% )) 
> 
> (define info-menu-item (new menu-item% 
>   (label "info") 
>   (parent row-edit-menu) 
>   (callback (lambda (menu-item event) 
>   (message-box "Info" 
>(~a "You have selected 
> " (length (send table3 get-selected-row-indexes)) " rows") 
>#f) 
>   )) 
>   )) 
> 
> (define table3 
>(new (class qresults-list% (init) (super-new) 
>   [parent frame3] 
>   [pref-tag 'preferences-tag] 
>   [selection-type 'multiple] 
>   [right-click-menu row-edit-menu]) 
>   ) 
> 
> (send table3 setup-column-defs my-columns) 
> 
> (send frame3 show #t) 
> 
> (send table3 add-row (vector "R1C1" 10)) 
> (send table3 add-row (vector "R2C1" 11)) 
> (send table3 add-row (vector "R3C1" 12)) 
> (send table3 add-row (vector "R4C1" 13)) 
> 
> 
> 
> -- 
> 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/01e04764-42b2-4619-8aff-32fbf4d68269%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 

Re: [racket-users] trickiness about the order of definitions in GUI code

2020-05-06 Thread James Platt
Thanks, Jon.  I'm going to try Alex's solution first but I may get back to this.


On May 6, 2020, at 8:49 PM, Jon Zeppieri wrote:

> On Wed, May 6, 2020 at 7:50 PM James Platt  wrote:
>> 
>> I'm working on organizing and documenting some things and I have some code, 
>> below, which works but I don't understand why.  Specifically, why don't I 
>> get an error about table3 not being defined?
> 
> The reason you don't get an error for the code you posted is because
> the mention of `table3` (before its definition) in `info-menu-item` is
> inside a function body. The referent of the name `table3` isn't
> required to define `info-menu-item`; it's sufficient to know that it
> refers to _something_, and that it will be available when that
> function is (later) called.
> 
>> In other words, I want to be able to define table3 in one file which 
>> requires the file where row-edit-menu is defined but I can't seem to figure 
>> out how to get this to work.
> 
> It's a bit trickier to define these things in separate files, because
> their definitions refer to each other (though indirectly in this
> case), and the module system does not tolerate cyclic dependencies.
> The most straightforward way to break the cycle would be to take
> advantage of the fact that `table3` and `info-menu-item` each depends
> on `row-edit-menu`, and `info-menu-item` further depends on `table3`,
> but `row-edit-menu` doesn't depend on either. So the dependencies
> aren't really cyclical. You can divide stuff up into separate modules
> like so:
> 
> menu.rkt
> ```
> #lang racket
> 
> (require racket/gui/base)
> 
> (provide frame3
> row-edit-menu)
> 
> (define frame3
>  (new frame%
>   [label "myTable 3"]
>   [width 800]
>   [height 600]))
> 
> (define row-edit-menu (new popup-menu%))
> ```
> 
> 
> table.rkt
> ```
> #lang racket
> 
> (require racket/gui/base
> qresults-list
> "menu.rkt")
> 
> (provide table3
> add-rows)
> 
> ;set up columns
> (define (column1 data) (vector-ref data 0))
> (define (column2 data) (vector-ref data 1))
> 
> (define my-columns
>  (list
>   (qcolumn "Column1" column1 column1)
>   (qcolumn "Column2"
>(λ (row)
>  ;(displayln row)
>  ;(displayln (db-row-ref row "Column2" headers 1))
>  (if (number? (column2 row)) (number->string (column2
> row)) "");This allows a cell to be blank.
>  ;(number->string (column2 row))
>  )
>column2)))
> 
> (define table3
>  (new (class qresults-list% (init) (super-new))
>   [parent frame3]
>   [pref-tag 'preferences-tag]
>   [selection-type 'multiple]
>   [right-click-menu row-edit-menu]))
> 
> (define (add-rows)
>  (send table3 add-row (vector "R1C1" 10))
>  (send table3 add-row (vector "R2C1" 11))
>  (send table3 add-row (vector "R3C1" 12))
>  (send table3 add-row (vector "R4C1" 13)))
> ```
> 
> 
> menu-item.rkt
> ```
> #lang racket
> 
> (require racket/gui/base
> "menu.rkt"
> "table.rkt")
> 
> (provide info-menu-item)
> 
> (define info-menu-item
>  (new menu-item%
>   [label "info"]
>   [parent row-edit-menu]
>   [callback (λ (menu-item event)
>   (message-box "Info"
>(~a "You have selected " (length (send
> table3 get-selected-row-indexes)) " rows")
>#f))]))
> ```
> 
> 
> main.rkt
> ```
> #lang racket
> 
> (require "menu.rkt"
> "table.rkt")
> 
> (send frame3 show #t)
> (add-rows)
> ```
> 
> Hope that helps.
> 
> - Jon
> 
> -- 
> 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/CAKfDxxwofLFVTkcGii%2BtLGKYCBFVNY2Tw9m8ZNjR--Hh_FRtEw%40mail.gmail.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/58CCDAB6-F650-4582-9038-5BA3C78728E8%40biomantica.com.


[racket-users] Re: trickiness about the order of definitions in GUI code

2020-05-06 Thread Alex Harsanyi
Every problem can be solved by adding another level of indirection (except 
perhaps having too many  levels of indirection :-) ).  You can put the code 
below in a separate file:

(define (make-info-menu-item parent target-table)
  (new menu-item%
  (label "info")
  (parent parent)
  (callback (lambda (menu-item event)
  (message-box "Info"
   (~a "You have selected " (length (send target-table get-
selected-row-indexes)) " rows")
   #f)

And use it like so:

(require "info-menu-item.rkt")
(define row-edit-menu (new popup-menu% ))
(define table3 ...)
(define info-menu (make-info-menu-item row-edit-menu table3)

You could also have just one "make-row-edit-menu" function which creates 
all menu items.

Alex.

On Thursday, May 7, 2020 at 7:50:01 AM UTC+8, James Platt wrote:
>
> I'm working on organizing and documenting some things and I have some 
> code, below, which works but I don't understand why.  Specifically, why 
> don't I get an error about table3 not being defined? 
>
> This is a very simplified version of what I'm working on.  What I actually 
> want to do is put all the code related to creating a standard table editing 
> menu in a file which I can then include wherever I want that menu.  The 
> full menu will be a lot of code.  Unfortunately I can't seem to get this to 
> work without either getting an error that row-edit-menu is not defined or 
> that table3 is not defined.  In other words, I want to be able to define 
> table3 in one file which requires the file where row-edit-menu is defined 
> but I can't seem to figure out how to get this to work.  It works just fine 
> when all the code is in one file, however. 
>
> James 
>
>
> #lang racket 
> (require racket/gui/base 
>  qresults-list 
>  ) 
>
> ;set up columns 
> (define (column1 data) (vector-ref data 0)) 
> (define (column2 data) (vector-ref data 1)) 
>
> (define my-columns 
>   (list 
>(qcolumn "Column1" column1 column1) 
>(qcolumn "Column2" 
> (lambda (row) 
>   ;(displayln row) 
>   ;(displayln (db-row-ref row "Column2" headers 1)) 
>   (if (number? (column2 row)) (number->string (column2 row)) 
> "");This allows a cell to be blank. 
>   ;(number->string (column2 row)) 
>   ) 
> column2) 
> 
>) 
>   ) 
>
> (define frame3 (new frame% 
>   [label "myTable 3"] 
>   [width 800] 
>   [height 600] 
>   )) 
>
>
> (define row-edit-menu (new popup-menu% )) 
>
> (define info-menu-item (new menu-item% 
>   (label "info") 
>   (parent row-edit-menu) 
>   (callback (lambda (menu-item event) 
>   (message-box "Info" 
>(~a "You have 
> selected " (length (send table3 get-selected-row-indexes)) " rows") 
>#f) 
>   )) 
>   )) 
>
> (define table3 
>(new (class qresults-list% (init) (super-new) 
>   [parent frame3] 
>   [pref-tag 'preferences-tag] 
>   [selection-type 'multiple] 
>   [right-click-menu row-edit-menu]) 
>   ) 
>
> (send table3 setup-column-defs my-columns) 
>
> (send frame3 show #t) 
>
> (send table3 add-row (vector "R1C1" 10)) 
> (send table3 add-row (vector "R2C1" 11)) 
> (send table3 add-row (vector "R3C1" 12)) 
> (send table3 add-row (vector "R4C1" 13)) 
>
>
>

-- 
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/01e04764-42b2-4619-8aff-32fbf4d68269%40googlegroups.com.


Re: [racket-users] trickiness about the order of definitions in GUI code

2020-05-06 Thread Jon Zeppieri
On Wed, May 6, 2020 at 7:50 PM James Platt  wrote:
>
> I'm working on organizing and documenting some things and I have some code, 
> below, which works but I don't understand why.  Specifically, why don't I get 
> an error about table3 not being defined?

The reason you don't get an error for the code you posted is because
the mention of `table3` (before its definition) in `info-menu-item` is
inside a function body. The referent of the name `table3` isn't
required to define `info-menu-item`; it's sufficient to know that it
refers to _something_, and that it will be available when that
function is (later) called.

> In other words, I want to be able to define table3 in one file which requires 
> the file where row-edit-menu is defined but I can't seem to figure out how to 
> get this to work.

It's a bit trickier to define these things in separate files, because
their definitions refer to each other (though indirectly in this
case), and the module system does not tolerate cyclic dependencies.
The most straightforward way to break the cycle would be to take
advantage of the fact that `table3` and `info-menu-item` each depends
on `row-edit-menu`, and `info-menu-item` further depends on `table3`,
but `row-edit-menu` doesn't depend on either. So the dependencies
aren't really cyclical. You can divide stuff up into separate modules
like so:

menu.rkt
```
#lang racket

(require racket/gui/base)

(provide frame3
 row-edit-menu)

(define frame3
  (new frame%
   [label "myTable 3"]
   [width 800]
   [height 600]))

(define row-edit-menu (new popup-menu%))
```


table.rkt
```
#lang racket

(require racket/gui/base
 qresults-list
 "menu.rkt")

(provide table3
 add-rows)

;set up columns
(define (column1 data) (vector-ref data 0))
(define (column2 data) (vector-ref data 1))

(define my-columns
  (list
   (qcolumn "Column1" column1 column1)
   (qcolumn "Column2"
(λ (row)
  ;(displayln row)
  ;(displayln (db-row-ref row "Column2" headers 1))
  (if (number? (column2 row)) (number->string (column2
row)) "");This allows a cell to be blank.
  ;(number->string (column2 row))
  )
column2)))

(define table3
  (new (class qresults-list% (init) (super-new))
   [parent frame3]
   [pref-tag 'preferences-tag]
   [selection-type 'multiple]
   [right-click-menu row-edit-menu]))

(define (add-rows)
  (send table3 add-row (vector "R1C1" 10))
  (send table3 add-row (vector "R2C1" 11))
  (send table3 add-row (vector "R3C1" 12))
  (send table3 add-row (vector "R4C1" 13)))
```


menu-item.rkt
```
#lang racket

(require racket/gui/base
 "menu.rkt"
 "table.rkt")

(provide info-menu-item)

(define info-menu-item
  (new menu-item%
   [label "info"]
   [parent row-edit-menu]
   [callback (λ (menu-item event)
   (message-box "Info"
(~a "You have selected " (length (send
table3 get-selected-row-indexes)) " rows")
#f))]))
```


main.rkt
```
#lang racket

(require "menu.rkt"
 "table.rkt")

(send frame3 show #t)
(add-rows)
```

Hope that helps.

- Jon

-- 
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/CAKfDxxwofLFVTkcGii%2BtLGKYCBFVNY2Tw9m8ZNjR--Hh_FRtEw%40mail.gmail.com.


[racket-users] trickiness about the order of definitions in GUI code

2020-05-06 Thread James Platt
I'm working on organizing and documenting some things and I have some code, 
below, which works but I don't understand why.  Specifically, why don't I get 
an error about table3 not being defined?

This is a very simplified version of what I'm working on.  What I actually want 
to do is put all the code related to creating a standard table editing menu in 
a file which I can then include wherever I want that menu.  The full menu will 
be a lot of code.  Unfortunately I can't seem to get this to work without 
either getting an error that row-edit-menu is not defined or that table3 is not 
defined.  In other words, I want to be able to define table3 in one file which 
requires the file where row-edit-menu is defined but I can't seem to figure out 
how to get this to work.  It works just fine when all the code is in one file, 
however.

James


#lang racket
(require racket/gui/base
 qresults-list
 )

;set up columns
(define (column1 data) (vector-ref data 0))
(define (column2 data) (vector-ref data 1))

(define my-columns 
  (list
   (qcolumn "Column1" column1 column1)
   (qcolumn "Column2"
(lambda (row)
  ;(displayln row)
  ;(displayln (db-row-ref row "Column2" headers 1))
  (if (number? (column2 row)) (number->string (column2 row)) 
"");This allows a cell to be blank.
  ;(number->string (column2 row))
  )
column2)
   
   )
  )

(define frame3 (new frame% 
  [label "myTable 3"]
  [width 800]
  [height 600]
  ))


(define row-edit-menu (new popup-menu% ))

(define info-menu-item (new menu-item%
  (label "info")
  (parent row-edit-menu)
  (callback (lambda (menu-item event)
  (message-box "Info"
   (~a "You have selected " 
(length (send table3 get-selected-row-indexes)) " rows")
   #f)
  ))
  ))

(define table3
   (new (class qresults-list% (init) (super-new)
  [parent frame3]
  [pref-tag 'preferences-tag]
  [selection-type 'multiple]
  [right-click-menu row-edit-menu])
  )

(send table3 setup-column-defs my-columns)

(send frame3 show #t)

(send table3 add-row (vector "R1C1" 10))
(send table3 add-row (vector "R2C1" 11))
(send table3 add-row (vector "R3C1" 12))
(send table3 add-row (vector "R4C1" 13))


-- 
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/F54B34B7-F04F-4DF7-9236-FD6C4FE3C983%40biomantica.com.


Re: [racket-users] double titlebar effect

2020-05-06 Thread Robby Findler
Looks like a problem with the tabs maybe? How does it look if you make a
new tab?

Robby


On Wed, May 6, 2020 at 3:18 PM Stephen De Gabrielle 
wrote:

> Hi,
> Any other racketeers seeing this?
> [image: image.png]
>
> DrRacket 7.7 cs and macOS Catalina
>
> Kind regards
> Stephen
>
> --
> 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/CAGHj7-KX%3DOWh_iaM70qWJ8YqfCtw30ipVopRd3dSw%2BEEs081ng%40mail.gmail.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/CAL3TdOO7RkzY6Y9R1fLAtHcym0ibVehOc3xkGxtBJq_ny5T5cg%40mail.gmail.com.


[racket-users] double titlebar effect

2020-05-06 Thread Stephen De Gabrielle
Hi,
Any other racketeers seeing this?
[image: image.png]

DrRacket 7.7 cs and macOS Catalina

Kind regards
Stephen

-- 
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/CAGHj7-KX%3DOWh_iaM70qWJ8YqfCtw30ipVopRd3dSw%2BEEs081ng%40mail.gmail.com.


Re: [racket-users] Questions about working on DrRacket and gui

2020-05-06 Thread Dexter Lagan
  If you open DrRacket, a new tab opens with #lang racket.
I can type anything I want, a lot of random characters, numbers etc. As soon as 
any keyword is recognized, there’s the pause. For example:

Hejheke
Idhnehje
Osjdjvehjekd
Hdiisbsidhjd
Gueojd jdbdbskbd jdjdb defino definii define <- pause here

  It does the same on any of my systems.

Dex

> On May 6, 2020, at 3:05 PM, Gustavo Massaccesi  wrote:
> 
> 
> I´m not sure if you are writing your own list of known symbols or if you are 
> reusing a list of known symbols that DrRacket is using for something else.
> 
> Gustavo
> 
>> On Wed, May 6, 2020 at 9:25 AM Dexter Lagan  wrote:
>>   If that can help, I narrowed down the delay to new files only, after 
>> typing a known symbol only. When opening an existing file, no matter what I 
>> type in, no delay. If I start a fresh DrRacket, I can type anything in the 
>> definitions window with no delay. The delay only happens if I type a known 
>> function name, for example ‘define’. If I type ‘defind’, there’s no delay. 
>> The delay also appears in Scheme mode, and with background expansion 
>> disabled. No delay in Text mode, which makes sense.
>> 
>>  
>> 
>>   I’m currently looking at the definitions-text from unit.rkt, to see 
>> where’s the hook that detects symbols. I have the day off, and I’m enjoying 
>> this very much.
>> 
>>  
>> 
>> Cheers,
>> 
>>  
>> 
>> Dex
>> 
>>  
>> 
>> From: Robby Findler  
>> Sent: Tuesday, May 5, 2020 6:18 PM
>> To: Gustavo Massaccesi 
>> Cc: Dexter Lagan ; Matthew Flatt 
>> ; Racket Users 
>> Subject: Re: [racket-users] Questions about working on DrRacket and gui
>> 
>>  
>> 
>>  
>> 
>>  
>> 
>> On Tue, May 5, 2020 at 10:36 AM Gustavo Massaccesi  
>> wrote:
>> 
>> I try to encourage people to participate, but be careful because this task 
>> is probably too big for a first contribution. GUI is difficult, DrRacket has 
>> a lot of moving parts, and opening DrRacket inside DrRacket is possible but 
>> weird.
>> 
>>  
>> 
>>  
>> 
>> +1
>> 
>>  
>> 
>> I think the guess of Matthew is correct, it´s a problem with the blue arrow 
>> with the docs. There is no pause while you type numbers but when you type a 
>> letter or +-*/... there is a pause of 1 or 2 seconds.
>> 
>>  
>> 
>> I didn't see the code but my guess is that the docs are loaded lazily in a 
>> thread and when DrRackets see something like an identifier it waits until 
>> the thread is ready. It would be nice if the blue arrow is disabled until 
>> the docs are completely loaded lazily. I think Robby can tell if I'm correct 
>> and how hard is to fix this.
>> 
>>  
>> 
>>  
>> 
>> Definitely sounds like an extremely actionable hypothesis to investigate 
>> and, if it turns out to be correct, I guess it should be a simple matter of 
>> programming to do what you're suggesting.
>> 
>>  
>> 
>> Robby
>> 
>>  

-- 
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/4297A05D-9CB4-4629-80C2-25B7206105A6%40gmail.com.


Re: [racket-users] Questions about working on DrRacket and gui

2020-05-06 Thread Gustavo Massaccesi
I´m not sure if you are writing your own list of known symbols or if you
are reusing a list of known symbols that DrRacket is using for something
else.

Gustavo

On Wed, May 6, 2020 at 9:25 AM Dexter Lagan  wrote:

>   If that can help, I narrowed down the delay to new files only, after
> typing a known symbol only. When opening an existing file, no matter what I
> type in, no delay. If I start a fresh DrRacket, I can type anything in the
> definitions window with no delay. The delay only happens if I type a known
> function name, for example ‘define’. If I type ‘defind’, there’s no delay.
> The delay also appears in Scheme mode, and with background expansion
> disabled. No delay in Text mode, which makes sense.
>
>
>
>   I’m currently looking at the definitions-text from unit.rkt, to see
> where’s the hook that detects symbols. I have the day off, and I’m enjoying
> this very much.
>
>
>
> Cheers,
>
>
>
> Dex
>
>
>
> *From:* Robby Findler 
> *Sent:* Tuesday, May 5, 2020 6:18 PM
> *To:* Gustavo Massaccesi 
> *Cc:* Dexter Lagan ; Matthew Flatt <
> mfl...@cs.utah.edu>; Racket Users 
> *Subject:* Re: [racket-users] Questions about working on DrRacket and gui
>
>
>
>
>
>
>
> On Tue, May 5, 2020 at 10:36 AM Gustavo Massaccesi 
> wrote:
>
> I try to encourage people to participate, but be careful because this task
> is probably too big for a first contribution. GUI is difficult, DrRacket
> has a lot of moving parts, and opening DrRacket inside DrRacket is possible
> but weird.
>
>
>
>
>
> +1
>
>
>
> I think the guess of Matthew is correct, it´s a problem with the blue
> arrow with the docs. There is no pause while you type numbers but when you
> type a letter or +-*/... there is a pause of 1 or 2 seconds.
>
>
>
> I didn't see the code but my guess is that the docs are loaded lazily in a
> thread and when DrRackets see something like an identifier it waits until
> the thread is ready. It would be nice if the blue arrow is disabled until
> the docs are completely loaded lazily. I think Robby can tell if I'm
> correct and how hard is to fix this.
>
>
>
>
>
> Definitely sounds like an extremely actionable hypothesis to investigate
> and, if it turns out to be correct, I guess it should be a simple matter of
> programming to do what you're suggesting.
>
>
>
> Robby
>
>
>

-- 
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/CAPaha9PF-YBGF3zfOPiVawzN7HLRYihO3t8VL50vdog141ZfAQ%40mail.gmail.com.


RE: [racket-users] Questions about working on DrRacket and gui

2020-05-06 Thread Dexter Lagan
  If that can help, I narrowed down the delay to new files only, after typing a 
known symbol only. When opening an existing file, no matter what I type in, no 
delay. If I start a fresh DrRacket, I can type anything in the definitions 
window with no delay. The delay only happens if I type a known function name, 
for example ‘define’. If I type ‘defind’, there’s no delay. The delay also 
appears in Scheme mode, and with background expansion disabled. No delay in 
Text mode, which makes sense.

 

  I’m currently looking at the definitions-text from unit.rkt, to see where’s 
the hook that detects symbols. I have the day off, and I’m enjoying this very 
much.

 

Cheers,

 

Dex

 

From: Robby Findler  
Sent: Tuesday, May 5, 2020 6:18 PM
To: Gustavo Massaccesi 
Cc: Dexter Lagan ; Matthew Flatt ; 
Racket Users 
Subject: Re: [racket-users] Questions about working on DrRacket and gui

 

 

 

On Tue, May 5, 2020 at 10:36 AM Gustavo Massaccesi mailto:gust...@oma.org.ar> > wrote:

I try to encourage people to participate, but be careful because this task is 
probably too big for a first contribution. GUI is difficult, DrRacket has a lot 
of moving parts, and opening DrRacket inside DrRacket is possible but weird.

 

 

+1

 

I think the guess of Matthew is correct, it´s a problem with the blue arrow 
with the docs. There is no pause while you type numbers but when you type a 
letter or +-*/... there is a pause of 1 or 2 seconds.

 

I didn't see the code but my guess is that the docs are loaded lazily in a 
thread and when DrRackets see something like an identifier it waits until the 
thread is ready. It would be nice if the blue arrow is disabled until the docs 
are completely loaded lazily. I think Robby can tell if I'm correct and how 
hard is to fix this.

 

 

Definitely sounds like an extremely actionable hypothesis to investigate and, 
if it turns out to be correct, I guess it should be a simple matter of 
programming to do what you're suggesting.

 

Robby

 

-- 
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/010201d623a1%245c4e23e0%2414ea6ba0%24%40gmail.com.


Re: [racket-users] Questions about working on DrRacket and gui

2020-05-06 Thread Dexter Lagan
  To add to my previous message, I know and understand that DrRacket and
GUI are very complex. I've been going over unit.rkt. Yeah it's a lot of
code. But it's not as bad as I thought.
I'm just offering a hand in making sense of it all. With enough time and
patience I'm sure I'll get something out of it. Now, if you think my time
would be better used for something else Racket-related, do tell.

Dex

On Tue, May 5, 2020 at 6:17 PM Robby Findler 
wrote:

>
>
> On Tue, May 5, 2020 at 10:36 AM Gustavo Massaccesi 
> wrote:
>
>> I try to encourage people to participate, but be careful because this
>> task is probably too big for a first contribution. GUI is difficult,
>> DrRacket has a lot of moving parts, and opening DrRacket inside DrRacket is
>> possible but weird.
>>
>>
> +1
>
>
>> I think the guess of Matthew is correct, it´s a problem with the blue
>> arrow with the docs. There is no pause while you type numbers but when you
>> type a letter or +-*/... there is a pause of 1 or 2 seconds.
>>
>> I didn't see the code but my guess is that the docs are loaded lazily in
>> a thread and when DrRackets see something like an identifier it waits until
>> the thread is ready. It would be nice if the blue arrow is disabled until
>> the docs are completely loaded lazily. I think Robby can tell if I'm
>> correct and how hard is to fix this.
>>
>>
> Definitely sounds like an extremely actionable hypothesis to investigate
> and, if it turns out to be correct, I guess it should be a simple matter of
> programming to do what you're suggesting.
>
> Robby
>
>

-- 
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/CACUENrKfb-Av93DdPhureK6FRA9AfGBiKqWPGb%2BAFM%2Bb6QWUQw%40mail.gmail.com.


Re: [racket-users] Questions about working on DrRacket and gui

2020-05-06 Thread Dexter Lagan
  Couple years ago I developed an IDE for NewLISP called NewIDE using a
commercial tool called Xojo. It was supposed to become NewLISP's official
IDE. I had to put the project on pause because of work and family, and at
the same time I switched to Racket, hence my interest. It had replicated
most of DrRacket's basic functions apart from the debugger and profiler,
but was much faster (native controls + LLVM). I have plenty of time on my
hands lately, and I'll take a couple hours each day to analyze DrRacket and
see where I can reduce delays and improve responsiveness. Who knows, it
might pay off.

After a quick first pass over each module, what DrRacket's source needs is :
1) a detailed description of what each module does;
2) a description of what each function/class does, methods and properties
etc. I don't see a lot of comments at the moment.

  I'll gladly volunteer to write those. I'll annotate the code as I go
through it, and I'll push it to a new github when I have enough of it
documented. If the DrRacket's authors are happy with the result, we'll
merge?

  As for the delay, I'm sure there's a callback somewhere which launches
the context-sensitive help, or loads the docs in the background like you
said. There's gotta be a way to move this loading time somewhere more
appropriate, like say during the init splash, or at the very least display
a loading dialog box to inform the user.

Let me know what you think,

Dex

On Tue, May 5, 2020 at 6:17 PM Robby Findler 
wrote:

>
>
> On Tue, May 5, 2020 at 10:36 AM Gustavo Massaccesi 
> wrote:
>
>> I try to encourage people to participate, but be careful because this
>> task is probably too big for a first contribution. GUI is difficult,
>> DrRacket has a lot of moving parts, and opening DrRacket inside DrRacket is
>> possible but weird.
>>
>>
> +1
>
>
>> I think the guess of Matthew is correct, it´s a problem with the blue
>> arrow with the docs. There is no pause while you type numbers but when you
>> type a letter or +-*/... there is a pause of 1 or 2 seconds.
>>
>> I didn't see the code but my guess is that the docs are loaded lazily in
>> a thread and when DrRackets see something like an identifier it waits until
>> the thread is ready. It would be nice if the blue arrow is disabled until
>> the docs are completely loaded lazily. I think Robby can tell if I'm
>> correct and how hard is to fix this.
>>
>>
> Definitely sounds like an extremely actionable hypothesis to investigate
> and, if it turns out to be correct, I guess it should be a simple matter of
> programming to do what you're suggesting.
>
> Robby
>
>

-- 
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/CACUENr%2BDgdCBJ3JDUT8MQMCaRY03A2-y5TtFXLO8bRe%3Dyctkpg%40mail.gmail.com.