add #:line option to report #4

Merged
AlexKnauth merged 1 commits from line into master 9 years ago
AlexKnauth commented 9 years ago (Migrated from github.com)

closes #1

closes #1
mbutterick commented 9 years ago (Migrated from github.com)

Genius.

Genius.
mbutterick commented 9 years ago (Migrated from github.com)

Having said that, I think it would be wiser to handle this as (report/line ...) rather than (report ... #:line), because:

  1. I’m not aware of any precedent for treating the raw keyword signal as an argument. Moreover the keyword signal won't actually accept an argument: something like (report ... #:line #t) produces a "bad syntax" error.
  2. report is a debugging tool, so in terms of ergonomics, it’s nicer to only have to type in one location. It's easier to change a (report ...) to (report/line ...) than to (report ... #:line).

I will make this tweak and update the docs.

Having said that, I think it would be wiser to handle this as `(report/line ...)` rather than `(report ... #:line)`, because: 1. I’m not aware of any precedent for treating the raw keyword signal as an argument. Moreover the keyword signal won't actually accept an argument: something like `(report ... #:line #t)` produces a "bad syntax" error. 2. `report` is a debugging tool, so in terms of ergonomics, it’s nicer to only have to type in one location. It's easier to change a `(report ...)` to `(report/line ...)` than to `(report ... #:line)`. I will make this tweak and update the docs.
AlexKnauth commented 9 years ago (Migrated from github.com)

1:
The precedents are things like (struct ... #:transparent), (defmodule ... #:no-declare) and (syntax-parse stx #:disable-colon-notation ...), and since report is a macro, it doesn't have to accept an argument after the keyword, so (report 5 #:line) works fine and shows the output:

5 = 5 on line 3
5

2:
I was thinking of keyword options because if more options are added, you don't need to add a form for every option, or even worse, a form for every possible combination of options, it's all handled by one form. For example originally there were many variants of defmodule with different options, but then keyword options were added to the main one for this same reason (I think).

1: The precedents are things like `(struct ... #:transparent)`, `(defmodule ... #:no-declare)` and `(syntax-parse stx #:disable-colon-notation ...)`, and since `report` is a macro, it doesn't have to accept an argument after the keyword, so `(report 5 #:line)` works fine and shows the output: ``` 5 = 5 on line 3 5 ``` 2: I was thinking of keyword options because if more options are added, you don't need to add a form for every option, or even worse, a form for every possible combination of options, it's all handled by one form. For example originally there were many variants of `defmodule` with different options, but then keyword options were added to the main one for this same reason (I think).
AlexKnauth commented 9 years ago (Migrated from github.com)

P.S. I had a problem with sugar/debug.rkt not noticing that typed/sugar/debug.rkt had changed, where normally it would. I'm guessing the require-via-wormhole messed it up. Do you know of any way to tell racket that sugar/debug.rkt depends on typed/sugar/debug.rkt?

P.S. I had a problem with `sugar/debug.rkt` not noticing that `typed/sugar/debug.rkt` had changed, where normally it would. I'm guessing the `require-via-wormhole` messed it up. Do you know of any way to tell racket that `sugar/debug.rkt` depends on `typed/sugar/debug.rkt`?
AlexKnauth commented 9 years ago (Migrated from github.com)

I had to explicitly run raco setup sugar to make sure it noticed the changes, and that's probably why you saw the syntax error.

I had to explicitly run `raco setup sugar` to make sure it noticed the changes, and that's probably why you saw the syntax error.
mbutterick commented 9 years ago (Migrated from github.com)

I was thinking of keyword options because if more options are added, you don't need to add a form for every option, or even worse, a form for every possible combination of options, it's all handled by one form

I’d agree if there were clearly a bunch of options that needed to be handled. But it’s taken quite a while just to get to a second (actually I also added a third, report/file). So for now, the principle of YAGNI applies (moreover it does not preclude keyword args later).

BTW another reason to not use keywords: makes it possible to search and replace one form of report for another.

BTW2, I have long thought it would be valuable to make a debug metalanguage that would enable certain atomic marks within the reader, so instead of writing out (report (proc arg ...)) you could do something like ^(proc (arg ...)) which would expand to the same thing, similar to ' and quote. Again, for ergonomic purposes, so that it would be fast to get these marks in & out of the source. One annoyance even with (report ...) is that you have to deal with the closing parenthesis.

I'm guessing the require-via-wormhole messed it up. Do you know of any way to tell racket that sugar/debug.rkt depends on typed/sugar/debug.rkt?

I think this happens because it’s a multi package, so the sugar and typed/sugar modules have separate compiled directories, but connected in an unorthodox way with require-via-wormhole. Seems like a job for info.rkt, though I haven’t experimented to see if it can specify intra-package dependencies.

> I was thinking of keyword options because if more options are added, you don't need to add a form for every option, or even worse, a form for every possible combination of options, it's all handled by one form I’d agree if there were clearly a bunch of options that needed to be handled. But it’s taken quite a while just to get to a second (actually I also added a third, `report/file`). So for now, the principle of YAGNI applies (moreover it does not preclude keyword args later). BTW another reason to not use keywords: makes it possible to search and replace one form of `report` for another. BTW2, I have long thought it would be valuable to make a `debug` metalanguage that would enable certain atomic marks within the reader, so instead of writing out `(report (proc arg ...))` you could do something like `^(proc (arg ...))` which would expand to the same thing, similar to `'` and `quote`. Again, for ergonomic purposes, so that it would be fast to get these marks in & out of the source. One annoyance even with `(report ...)` is that you have to deal with the closing parenthesis. > I'm guessing the require-via-wormhole messed it up. Do you know of any way to tell racket that sugar/debug.rkt depends on typed/sugar/debug.rkt? I think this happens because it’s a `multi` package, so the `sugar` and `typed/sugar` modules have separate `compiled` directories, but connected in an unorthodox way with `require-via-wormhole`. Seems like a job for `info.rkt`, though I haven’t experimented to see if it can specify intra-package dependencies.
The pull request has been merged as ff87149376.
You can also view command line instructions.

Step 1:

From your project repository, check out a new branch and test the changes.
git checkout -b line master
git pull origin line

Step 2:

Merge the changes and update on Gitea.
git checkout master
git merge --no-ff line
git push origin master
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: mbutterick/sugar#4
Loading…
There is no content yet.