sorawee
2021-8-31 07:26:54

@shu—hung is ... supposed to be clickable in the REPL? Cuz I can’t click it.


shu--hung
2021-8-31 07:35:05

Yes, but: • The output area is locked, while expanding the S-exps is an editing operation. Therefore (...)s have to be copied to the prompt area (> ) • S-exp snips don’t respond to clicks. Instead, there is a “expand” option in the right-click context menu.


sorawee
2021-8-31 07:36:08

I don’t see the expand option :neutral_face:


shu--hung
2021-8-31 07:36:40

Maybe the context menu can be scrolled down?


shu--hung
2021-8-31 07:37:46

In the definition window, if you right click and select “Collapse S-expression”, the same kind of "(…)" snips will appear


sorawee
2021-8-31 07:38:39

It’s funny. I have '(123 (store 456)).

It’s printed as (123 (...))

And then I can collapse it to (...) and expand it back to (123 (...)).

But I can’t expand the inner (...).


shu--hung
2021-8-31 07:42:11

Ah, a difference could be that I directly sets the global print to sexp-pp


shu--hung
2021-8-31 07:43:04

In the definition window: (current-print sexp-pp) Then in REPL: > '(123 (store 456)) '(123 (...))


shu--hung
2021-8-31 07:43:50

There is probably some DrRacket magic that makes the two non-equivalent

EDIT: write-special works with traces but doesn’t work in the REPL — replace the line with write-special with (old-print-hook s display-mode? out-port) to make it work in REPL. However, old-print-hook doesn’t work in traces.


sorawee
2021-8-31 07:52:05

> The output area is locked, while expanding the S-exps is an editing operation. Therefore (…)s have to be copied to the prompt area (> ) Some error messages have ... that we can click to see more information, right? How does that work while the editor is locked?


shu--hung
2021-8-31 07:53:04

It’s probably not a racket:sexp-snip% but a different DrRacket GUI component


shu--hung
2021-8-31 07:56:19

If sexp-snip%s are more sophisticated, like embedding an editor inside it, then it may be expandable


soegaard2
2021-8-31 08:04:44

I just fixed a bug report in Sketching. The Sketch window spawned off screen on Windows. I had used [x display-width] [y 0] to place the window at the upper, right hand corner. On macOS this works fine. On Windows it was placed outside the screen.

Is there a way to place the frame at the upper, right corner on Windows?



soegaard2
2021-8-31 08:06:02

Or is the best approach to create the window and then move it afterwards?


alexharsanyi
2021-8-31 08:30:11

Maybe I don’t understand what you are trying to do, but if you place a window such that its top-left corner is at the display width, I would expect it to be off screen.

Maybe you meant to place the window at [x (- display-width window-width)]

You also need to take into account that on Windows there is an invisible border of approximately 5 pixels around each window — since the windows themselves have no drawn border yet the user needs to be able to click and drag the edge of the window to enlarge it…


soegaard2
2021-8-31 08:35:24

Turns out it macOS moves it, so it is visible. You right, the expectation ought to be that it is displayed outside. The problem is that I don’t know the window size until after the frame is created. I didn’t know about the 5 pixel border.

Would it make sense to use the default - but if the window is moved, store the new position on disk to be used for the next program invocation?


alexharsanyi
2021-8-31 08:48:16

Once you have created all the widgets inside the window, and before you show it, call reflow-container — this will calculate the size of the window


sschwarzer
2021-8-31 08:48:19

Do we want a Racket online meeting on Saturday? If yes, I’d suggest the time and “place” as mentioned at https://racket-news.com/2021/07/racket-news-issue-52.html#meetups .


soegaard2
2021-8-31 08:48:56

That sounds like the proper way.


christos.perivolaropo
2021-8-31 11:01:12

@christos.perivolaropo has joined the channel


christos.perivolaropo
2021-8-31 11:04:54

hello, is there any good code formatter that can insert newlines (like racket/pretty) that also respects comments? I am looking for something like clang-format for C/C++, or brittany for haskell, or js-beautify, etc.


christos.perivolaropo
2021-8-31 12:09:00

There’s places in the racket source code where it seems a tool was used to polish up the code (eg https://github.com/racket/racket/blob/master/racket/collects/syntax/module-reader.rkt#L37L46 )


abmclin
2021-8-31 14:28:08

If a full-fledged condition system is to be implemented in Racket, there are two possible approaches. First would be to enlarge the exception hierarchy where exn is a subtype of conditions that are non-resumable. The second approach is to make conditions a subtype of exn. Not sure which one is better.

I remember there was a proposal for adding conditions and restarts to Scheme a while ago that stood out among competing proposals but unfortunately I’ve forgotten where I saw it.


soegaard2
2021-8-31 15:18:07

@christos.perivolaropo I think most people just “select all” and then “indent” in either DrRacker or racket-mode. Also, in DrRacket you can choose to get a “vertical column guide” when your lines are too long.


christos.perivolaropo
2021-8-31 16:43:56

I am actually using racket-mode in emacs (which also provides an indent-region command). Does the drracket version also align let/cond/match forms or other things like that to help readability?


greg
2021-8-31 17:03:46

Yes it does


greg
2021-8-31 17:05:35

To be clear, neither will insert newlines for you.


greg
2021-8-31 17:06:34

An indenter takes the newlines as givens, and adjusts indentation of each line.


greg
2021-8-31 17:09:15

A “pretty printer” effectively throws away all the newlines and indents, and redoes the whole thing, using some parameter for max width.


greg
2021-8-31 17:09:58

However the pretty printers I know of do not attempt to handle the special indentation for various special forms (macros) that the indenters do handle.


greg
2021-8-31 17:10:33

By convention, in Lisps procedure applications are indented consistently.


greg
2021-8-31 17:10:41

But macros might use special indentation.


greg
2021-8-31 17:10:54

In some Lisps this can be communicated in the macro definition.


greg
2021-8-31 17:11:23

But in Scheme and Racket it’s done “out of band” with special rules in the editor or other tool, saying how to handle various forms.


greg
2021-8-31 17:11:51

That’s my hopefully mostly correct, Cliff Notes summary. :slightly_smiling_face:


ben.knoble
2021-8-31 20:02:04

(seems correct to me, including from the vim side)


tgbugs
2021-9-1 03:19:30

Question: I have been having issues with setting file-position in different contexts. I was finally able to determine that the difference in behavior was triggered by enabling line counting via port-count-lines!. If line counting has been enabled for a port is it required to use set-port-next-location! in order to actually get the file position to change?


shu--hung
2021-9-1 03:21:48

Are you using port-next-location to retrieve the current location or are you using file-position to get the reading position?


tgbugs
2021-9-1 03:23:13

I use file-position to get the current location, but I am fiddling around inside parser-tools, which might be using port-next-location which might explain the discrepancy?


shu--hung
2021-9-1 03:24:56

Could be! I know nothing about the parser tools :slightly_smiling_face:


shu--hung
2021-9-1 03:25:34

But yes, I suspect the port-next-location counting has an independent counter not sync’d with file-position.


shu--hung
2021-9-1 03:26:01

File-position should still set the reading position at OS level, though


tgbugs
2021-9-1 03:34:00

It does. However they do get out of sync, and it looks like parser-tools is using port-next-location for some things.


tgbugs
2021-9-1 03:35:12

port-next-location does have a separate tracker that is updated independently, I’m still having issues, but they are new issues, so progress. Thanks!


shu--hung
2021-9-1 03:38:44

Looks like there are more subtle points: https://docs.racket-lang.org/reference/linecol.html#%28def._%28%28quote._~23~25kernel%29._port-next-location%29%29

One is counting in bytes, while the other is counting in characters (in UTF–8). This matters especially when there are non-ASCII characters.


tgbugs
2021-9-1 03:43:28

hrm, I will cross that bridge when I get there, for now it seems that everything is synced up and happy if I set-port-next-location! to 1 more than what I do with the file position, but that will clearly get out of sync at some point so I will transition all the math over to port-next-location to avoid issues in the future.


migueldrums741
2021-9-1 03:53:03

@migueldrums741 has joined the channel


migueldrums741
2021-9-1 04:00:03

Hi everyone, happy to join to this group. Greetings from Venezuela :flag-ve:. Can someone give recommends to create a Web Site with Racket? Some guide or some advice. Thank you in advance. Sorry for my rookie question.


seanbunderwood
2021-9-1 04:17:17

hj93
2021-9-1 04:50:41

Wouldn’t you say that Racket is the ideal language for software engineering? Programming is about conquering complexity and the ultimate way to do this is by writing interpreters and compilers. Dr. Felleisen has promoted Racket as a language oriented language. If racket is built to write DSLs quickly and if metalinguistic abstraction is the ultimate abstraction then isn’t Racket the ideal language? In addition to this Racket is academic, has a test suite integrated with the language. For these reasons I think I’m switching from Common Lisp to Racket. Do you guys agree or disagree?


jestarray
2021-9-1 05:24:35

i never used common lisp and you’re asking in a racket channel so there are probably some biases. I think while its good that racket provides very good facilities for those who want to explore language design, creating a DSL is the last thing I reach for because it require a lot of maintenance and documentation for users, etc. see : http://www.winestockwebdesign.com/Essays/Lisp_Curse.html the lisp curse


jmhimara
2021-9-1 05:52:16

Yeah, I’m not into the “Language Oriented Programming” thing either. I’m more in favor of creating tools in an ecosystem the user is already familiar with.