deactivateduser60718
2020-1-2 15:43:17

Hi all. Thank you for the details. I think my play here should be to go heads down on it again, then come up for air for another review.


chris613
2020-1-2 18:34:19

@popa.bogdanp interesting app :smile: i have litternally today just been investigating racket ffi objc stuff :smile:


chris613
2020-1-2 18:34:49

the UI looks remarkably similar to spotlight. are you piggy backing of spotlight at all ?


popa.bogdanp
2020-1-2 18:47:30

Nope! You’re right that it’s basically a carbon copy of Spotlight UI-wise, but I’m just composing a couple APIs to imitate Spotlight’s UI.

The relevant code is:

https://github.com/Bogdanp/remember/blob/master/cocoa/remember/remember/ContentView.swift#L25 and • https://github.com/Bogdanp/remember/blob/master/cocoa/remember/remember/VisualEffectBackground.swift#L12


chris613
2020-1-2 18:49:05

cool :slightly_smiling_face: before i go digging, do you do any ffi -> native SDK stuff ??


popa.bogdanp
2020-1-2 18:49:10

I had initially started out using objc ffi to build the UI but realized that I’d end up having to write Objective-C-but-in-Racket so I figured going with a Swift shell that talks to a Racket core would be easier.


popa.bogdanp
2020-1-2 18:50:08

If the UI weren’t so out of the ordinary and if I didn’t need stuff like the ability to bind a custom global hotkey or launch the app at login then building the UI in Racket might’ve made more sense.


popa.bogdanp
2020-1-2 18:50:38

Possibly a lot less frustrating, too, because I find apple’s documentation to be lackluster.


popa.bogdanp
2020-1-2 18:51:51

Here’s my initial proof-of-concept where I did do some objc ffi:

https://gist.github.com/Bogdanp/3fa6dec42a9bd7fa4422e0e0cd1cd23b#file-remember-poc-rkt-L54


chris613
2020-1-2 18:54:00

Thanks! :smile:


notjack
2020-1-3 03:35:56

today I learned that you can’t make a variable-like match expander, like you can make variable-like macros


samth
2020-1-3 03:37:59

@notjack that seems like it would be weird since identifiers are binders in match


notjack
2020-1-3 03:38:54

example: (define-match-expander empty-sequence (syntax-parser [_:id #'(? sequence? (app sequence-length 0))])) > (match (list 1 2 3) [empty-sequence 'empty!] [_ 'not-empty!]) 'empty! ; oh dear :(


notjack
2020-1-3 03:42:18

@samth for context, this is what I wanted to make work: (define-enum-type direction (up down left right)) (define-tuple-type point (x y)) (define (point-move pt dir amount) (match-define (point x y) pt) (match dir [up (point x (+ y amount))] [down (point x (- y amount))] [left (point (- x amount) y)] [right (point (+ x amount) y)])) I can do it with == patterns instead of bare identifiers, but sadly that means custom enum types are second class citizens to built-in types, since they don’t get a “literal” match pattern the way numbers, characters, strings, and symbols do


samth
2020-1-3 03:47:47

I think it’s accurate that self-quoting data is special in match, but I feel like that’s one of many places that’s it’s special in Racket in general. Maybe this is a bad thing, but it’s pretty pervasive.


notjack
2020-1-3 03:56:07

True


notjack
2020-1-3 03:56:12

== patterns it is then