profile
viewpoint
Zephyr Shannon RadicalZephyr @bespoke-binary Portland, OR http://www.zephyrizing.net/ Conscientious committed Clojurian. Rapidly reifying Rustacean.

bike-barn/hermit 19

A home directory configuration management assistant

RadicalZephyr/boot-javac-star 4

[DEPRECATED] Compile java classes in a (potentially) reloadable fashion.

7hoenix/7roxy 1

Proxy is an open source Artificial Intelligence (AI) Agent

crockeo/petulant-life 1

A Clojure & OpenGL implementation of Conway's Game of Life.

RadicalZephyr/advent-of-haskell 1

Advent of Code in Haskell

RadicalZephyr/automator-git 1

Mac Automator plugins for Git

bunkai-kata/coin-changer.clj 0

The coin changer kata in clojure

RadicalZephyr/.emacs.d 0

Prelude is an enhanced Emacs 24 distribution that should make your experience with Emacs both more pleasant and more powerful.

startediliekturtles/uom

started time in 13 hours

push eventRadicalZephyr/.emacs.d

Geoff Shannon

commit sha a3b3cbbe28aa02c654621c62f672c87a3b5341b3

Save bookmarks file

view details

push time in 2 days

push eventRadicalZephyr/.emacs.d

Geoff Shannon

commit sha 1ed0dcef2684b064f9aaf692b8a429a5177bc7f2

Bind rust hooks to function cells not symbol values

view details

Geoff Shannon

commit sha dfcf6711114ef08ec9a400e8173b124958de68d5

Add binding so that cargo output is ansi-colorized

view details

push time in 2 days

startedopenai/gpt-3

started time in 4 days

pull request comment7hoenix/scripting

Suggested edits

Also, in case you want to use any of this info, the stuff that I wrote for the talk I gave on bash scripting is no github and my website:

  • https://www.zephyrizing.net/presentations/introduction-to-bash/
  • https://github.com/RadicalZephyr/radicalzephyr.github.io/blob/source/source/presentations/introduction-to-bash/index.org

Feel free to use any of it.

RadicalZephyr

comment created time in 7 days

pull request comment7hoenix/scripting

Suggested edits

I also added a whole thing about using #!/usr/bin/env bash which is a more portable way to write bash scripts. However, I don't know, I feel like it might be a bit of a distraction, or maybe an extension you add on later.

RadicalZephyr

comment created time in 7 days

push eventRadicalZephyr/scripting

Geoff Shannon

commit sha 28a2db487095b6f567c7dcafdbde7fa84ce6ef5b

Changes to lesson2

view details

Geoff Shannon

commit sha fdd4e2df8f1d34075ac1f9cf2d71b1193dd9399c

Explain usage of `/usr/bin/env`

view details

push time in 7 days

PR opened 7hoenix/scripting

Suggested edits

I fixed some typos, and made it so that your commentary in the shell blocks are in shell comments.

I also expanded a little bit on the details of the shebang as well.

+64 -21

0 comment

4 changed files

pr created time in 7 days

create barnchRadicalZephyr/scripting

branch : suggested-edits

created branch time in 7 days

startednotable/notable

started time in 7 days

fork RadicalZephyr/scripting

Scripts and automation

fork in 7 days

pull request commentSodiumFRP/sodium-rust

Port c++ tests

Sounds good! I probably won't get to adding more tests until the weekend but I'll make sure I'm up to date before I do.

RadicalZephyr

comment created time in 12 days

pull request commenttokio-rs/tokio

Add audit check

I'll follow up with another PR when my PR to add an args parameter to audit-check gets accepted :crossed_fingers:

RadicalZephyr

comment created time in 13 days

pull request commentactions-rs/audit-check

Add an input for passing additional arguments to cargo audit call

Hey @svartalf could you take a look at this when you get a chance? I'd love to be able to use this feature in the audit check for tokio.

RadicalZephyr

comment created time in 13 days

delete branch RadicalZephyr/tokio

delete branch : add-audit-check

delete time in 13 days

delete branch RadicalZephyr/sodium-rust

delete branch : format-code

delete time in 13 days

push eventRadicalZephyr/.emacs.d

Geoff Shannon

commit sha 1078ff837b45eb2e2deb01406a5d960c26795b40

Add a bunch of rust snippets

view details

Geoff Shannon

commit sha c58fd8f5094aca61d00cf2587bf00adfdc72d713

Add a Browser.sandbox starter snippet for Elm

view details

Geoff Shannon

commit sha a73671c4eb3ab2c66b30afe4e2f5e51d7d14dd99

Activate prelude typescript module

view details

push time in 14 days

startedrust-lang/rustc-dev-guide

started time in 14 days

PR opened SodiumFRP/sodium-rust

Port c++ tests

Start on porting all of the tests from sodium-cxx-alt.

To make sure I don't miss any I'm also rearranging the tests so they are in the same order in the file.

+476 -269

0 comment

1 changed file

pr created time in 14 days

issue commentSodiumFRP/sodium-rust

Change IsLambda* trait structure

Without the & the arguments are passed by copy. (Defensive copy). So mutation of the arguments does no harm. Both Fn and FnMut will let you mutate that copy of the arguments.

It's really passed by move, but since we want to keep the value/state in the sodium object we have no choice but to copy/clone. Making it pass by copy for the arguments.

The only real difference between Fn and FnMut is that FnMut lets you mutate captured state. Which allows FnMut to return a different result each time it is executed with the same arguments.

Ah, you are totally right. I got a little overexcited about that idea and didn't really think it through.

I think my thoughts on this API change are pretty half-baked right now, and not really grounded in how sodium is actually implemented currently or what the goals are, though this discussion has certainly been making things clearer. I think I'll keep working on porting tests and fixing any bugs that they expose in the implementation and getting more experience working in the codebase that way.

RadicalZephyr

comment created time in 14 days

push eventRadicalZephyr/sodium-rust

Geoff Shannon

commit sha ad47b61672087854650fe818a1484541e297dc73

Add failing test snapshot_initial_value

view details

push time in 14 days

create barnchRadicalZephyr/sodium-rust

branch : port-c++-tests

created branch time in 14 days

PR opened SodiumFRP/sodium-rust

Format code

Reformats the code using rustfmt.

Also adds a formatting check to the CI workflow.

In addition, now that all Clippy warnings have been taken care of in my previous pull request, I change the clippy check in CI to fail on warnings.

Fixes #52

+1196 -938

0 comment

25 changed files

pr created time in 14 days

create barnchRadicalZephyr/sodium-rust

branch : format-code

created branch time in 14 days

push eventRadicalZephyr/sodium-rust

Geoff Shannon

commit sha 0f8d8b2bb772a1af91f772a56b6efa5e477bb310

Remove unneeded lifetime parameters from IsLambda* traits

view details

Geoff Shannon

commit sha 5d92609c1c7a166c49a120c860ebe1eda20eb2dd

Remove unneeded mut qualifiers in tests

view details

Geoff Shannon

commit sha d89644d739758142f35558c3f840395646b4135f

Add some trivial Default implementations

view details

Geoff Shannon

commit sha 5d7ae988c276e3948747426af03f97734c795be3

Use simplified struct constructor syntax

view details

Geoff Shannon

commit sha 51bb2ce935e2f07905b82eb398aef8fd5e69a90c

Remove unneeded explicit return statements

view details

Geoff Shannon

commit sha 23651ba4fcfa2c57d38ed313133544669a970702

Remove unnecessary clones

view details

Geoff Shannon

commit sha 6235fdbd10b03b6fd977ef4a39a96f475273a267

Use operator-assign operators for updating values

view details

Geoff Shannon

commit sha 10008ea045ca163829242e22b5dc22ca78e1dc3c

Use cloned/copied methods instead of mapping clone explicitly

view details

Geoff Shannon

commit sha 636b235ec9a51189169143ecbaf54255f8e9326e

Change borrowed Vec argument types to be slices instead

view details

Geoff Shannon

commit sha dd3b329f184b59184ce73ecf7eddf148792eb7fd

Break up ThreadSpawner spawn_fn type signature with an alias

view details

Geoff Shannon

commit sha 894da3b8b5bb5e12e473b7d918f7411b5189967f

Remove unneeded nesting in else

view details

Geoff Shannon

commit sha 5cf6b4da43e147f7c07fcda6678040af6bbe24f2

Fix several minor clippy lints - Ignore two lints that aren't desirable or possible to fix - Remove unneeded &mut from a match - Remove unneeded empty string from writeln - Remove errant end of line whitespace

view details

Geoff Shannon

commit sha e3d6c787ce7747644b34674f97378672eb8fb699

Make clippy warnings fail CI and change to using clippy-check action

view details

Geoff Shannon

commit sha 9ed3e38db4b5172edddfadf27424212aa46af0b1

Replace usage of Mutex<usize> with AtomicUsize in SodiumCtx

view details

Geoff Shannon

commit sha bb9ca24d9efe2c9be1cce6c223569ab57acadf43

Improve CI setup Couple of changes to make the CI situation a bit more robust and complete: - Run the tests on all three toolchain channels - Allows the nightly channel job to fail without failing the whole build - Run clippy check separately and with the specific action for nice warning/error annotations - Remove formatting check since code is not currently formatted according to the rustfmt style

view details

Geoff Shannon

commit sha 6a304d8ef5b644d7d05848ea4733eb83b9cde4ae

Add regular dependency security audit

view details

Clinton Selke

commit sha ea94aa981bbbd0e88f15011b30874572cec62710

Merge pull request #51 from RadicalZephyr/improve-ci Improve CI setup

view details

Clinton Selke

commit sha 36fdfbb27480b11ca75da46745d1e37d383ce17f

Merge branch 'minor-cleanups' of https://github.com/RadicalZephyr/sodium-rust into RadicalZephyr-minor-cleanups

view details

Clinton Selke

commit sha 4fa019bd0a943ceaa77ece67fd933322df9f8678

Merge branch 'RadicalZephyr-minor-cleanups'

view details

push time in 14 days

push eventRadicalZephyr/cargo.el

Geoff Shannon

commit sha 91f82196bc4ef874a4f4a016b71dbe2b45531ac1

Add crate features to generated macro code to let it compile

view details

push time in 14 days

issue closedSodiumFRP/sodium-rust

Provide a Drop-based API for Listener cancellation

I think it might also be useful to provide an opt-in Drop-based API for cancelling Listeners like the one described in #53 for Transactions. This would let sodium users simply stash a handle to the ListenerGuard or whatever we call it in a struct that is related to that listener, or move it into the environment of a closure etc. so that the Listener gets automatically cleaned up when those items go out of scope.

For 3.0 it might even be nice to make that the default behavior and then if the user wants the Listener to live forever they can intentionally leak the Listener by calling a method on it.

closed time in 14 days

RadicalZephyr

issue commentSodiumFRP/sodium-rust

Provide a Drop-based API for Listener cancellation

Oh, awesome! I still haven't fully explored the API that currently exists

RadicalZephyr

comment created time in 14 days

push eventRadicalZephyr/mustache

Geoff Shannon

commit sha 282eb88eb5e69b6c92f03345762e6663ccf1eb2b

Add a test demonstrating empty strings render sections AND inverted sections

view details

Geoff Shannon

commit sha 0b376ad75ae9007e7eb1854134f03dac0854e617

Fix empty string rendering inverted sections Fixes #206.

view details

push time in 15 days

create barnchRadicalZephyr/mustache

branch : fix-truthy-falsey-empty-string

created branch time in 15 days

issue openedSodiumFRP/sodium-rust

Provide a Drop-based API for Listener cancellation

I think it might also be useful to provide an opt-in Drop-based API for cancelling Listeners like the one described in #53 for Transactions. This would let sodium users simply stash a handle to the ListenerGuard or whatever we call it in a struct that is related to that listener, or move it into the environment of a closure etc. so that the Listener gets automatically cleaned up when those items go out of scope.

For 3.0 it might even be nice to make that the default behavior and then if the user wants the Listener to live forever they can intentionally leak the Listener by calling a method on it.

created time in 15 days

issue openedSodiumFRP/sodium-rust

Provide Drop-based API for Transactions

I think it should be possible to implement an API similar to what I'm seeing in your cxx-alt variant of sodium where a Transaction object can be created that keeps the transaction open as long as that struct is alive and closes the transaction when it is destructed. This would give the same sort of RAII-guard type benefits and allow the tests between the two variants to look MUCH more similar.

created time in 15 days

issue openedSodiumFRP/sodium-rust

Reformatting code (question)

Hi @clinuxrulz,

I wanted to ask if you would be all right with me reformatting the entire crate using the standard Rust code formatting tool rustfmt.

While working inside Sodium I've really been noticing how much harder it is for me to quickly read and understand the code because it's not quite in that canonical format that I'm so used to. We could then add back in the piece of the former CI I took out which was supposed to be checking the code for correct formatting.

created time in 15 days

issue commentSodiumFRP/sodium-rust

Change IsLambda* trait structure

Oh, that's really good news. I didn't even think to try that abbreviated inferencing!

I think in general since most values are already passed by reference removing the &s on the arguments in the IsLambda actually won't change anything, because T and &T are different types that are both valid to be inferred as the type of an argument.

And if in 3.0 we change the FnMut to a Fn we'll get the same guarantee of not being able to mutate the arguments without using interior mutability that the current usage of & in the signature enforces.

RadicalZephyr

comment created time in 15 days

delete branch RadicalZephyr/sodium-rust

delete branch : minor-cleanups

delete time in 15 days

push eventRadicalZephyr/.emacs.d

Geoff Shannon

commit sha 5fc116c0abb3e088902274e4f6554cdbf0d57dbd

Add super::* to rust tests snippet

view details

push time in 15 days

delete branch RadicalZephyr/sodium-rust

delete branch : improve-ci

delete time in 15 days

PR opened SodiumFRP/sodium-rust

Improve CI setup

This PR brings the CI setup for sodium-rust more into line with typical good practices for testing Rust libraries. We now run the tests against both the stable and beta compiler channels. We also test against the nightly channel, but a failure there is not considered a failure of the whole build (since it's slightly more likely the compiler might have a bug on that channel).

I also separated out the Clippy lint check into a separate job that uses the actions-rs/clippy-check action which nicely formats the error and warning messages that Clippy spits out.

I also changed the activation of the CI run to only trigger on pushes or pull requests to the master branch so there will be less notification spam.

Finally, I added a separate workflow for running the excellent cargo-audit via the actions-rs/audit-check action to check for any reported vulnerabilities in sodium's dependencies. This workflow will run when any change is made to the dependencies, and also once a day on the master branch to catch any newly reported vulnerabilities in any current dependency. These daily checks will open an issue on the repository if any issues are found.

+63 -25

0 comment

3 changed files

pr created time in 18 days

push eventRadicalZephyr/sodium-rust

Geoff Shannon

commit sha bb9ca24d9efe2c9be1cce6c223569ab57acadf43

Improve CI setup Couple of changes to make the CI situation a bit more robust and complete: - Run the tests on all three toolchain channels - Allows the nightly channel job to fail without failing the whole build - Run clippy check separately and with the specific action for nice warning/error annotations - Remove formatting check since code is not currently formatted according to the rustfmt style

view details

Geoff Shannon

commit sha 6a304d8ef5b644d7d05848ea4733eb83b9cde4ae

Add regular dependency security audit

view details

push time in 18 days

push eventRadicalZephyr/sodium-rust

Geoff Shannon

commit sha aba44af4077c544c34796ea9aef045d1e63a83c2

Improve CI setup Couple of changes to make the CI situation a bit more robust and complete: - Run the tests on all three toolchain channels - Allows the nightly channel job to fail without failing the whole build - Run clippy check separately and with the specific action for nice warning/error annotations - Remove formatting check since code is not currently formatted according to the rustfmt style

view details

Geoff Shannon

commit sha 775bbe64018506231bb453e2e43ef633993ff5f4

Add regular dependency security audit

view details

push time in 18 days

push eventRadicalZephyr/sodium-rust

Geoff Shannon

commit sha a0427efb8c1c76fcb022dc3656b8f31a3bbf0666

Improve CI setup Couple of changes to make the CI situation a bit more robust and complete: - Run the tests on all three toolchain channels - Run clippy check separately and with the specific action for nice warning/error annotations - Remove formatting check since code is not currently formatted according to the rustfmt style

view details

Geoff Shannon

commit sha b69a056f3e2bec89663c015bbd58b1c60f2b5b7a

Add regular dependency security audit

view details

push time in 18 days

create barnchRadicalZephyr/sodium-rust

branch : improve-ci

created branch time in 18 days

CommitCommentEvent

startedbaku89/glisp

started time in 18 days

issue commentSodiumFRP/sodium-rust

Change IsLambda* trait structure

I think that the change in 1.35 is actually just implementing the relevant traits for boxed versions of the various Fn types. It looks like it is possible to implement the fn traits, but it's currently behind an unstable feature flag which would mean that using sodium would require using a nightly compiler which is not super nice for users. Doesn't really look like it's even ready to be stabilized any time soon so probably best not to depend on that route.

RadicalZephyr

comment created time in 18 days

push eventRadicalZephyr/sodium-rust

Geoff Shannon

commit sha c4f6ba370397f94ae7f92d0ca0f86c982504af88

Translate snapshot test into Rust syntax

view details

Geoff Shannon

commit sha 9a0fbed375dc0b7151d9c5328cedaf1d39bb51ac

Translate values test into rust syntax

view details

Geoff Shannon

commit sha 494b5c0e64c1e7eddf7fe4880c1c6e49bb6ca20f

Translate the send before listen cell test

view details

Geoff Shannon

commit sha 2b988733930099d20876e311f2e68a045da14e8f

Translate cell lift test

view details

Geoff Shannon

commit sha 01aa21bffbd9a96453b2418c34752738e9bdc8b7

Translate lift glitch test

view details

Geoff Shannon

commit sha 65b4577980f06ec70451962fa5d54106bb4ac192

Translate lift_from_simultaneous test

view details

Geoff Shannon

commit sha babc4adc17ab825a661f00754a1549a71afc4c88

Move all sodium tests into one tests file

view details

Geoff Shannon

commit sha 547ae5969f10b811c45e64a091842fb1315688f2

Move sodium tests directly into main test module

view details

Clinton Selke

commit sha 213b48f7e787c98552aec71694584e9be9eb5bba

Merge pull request #49 from RadicalZephyr/port-tests Port tests

view details

push time in 18 days

delete branch RadicalZephyr/sodium-rust

delete branch : port-tests

delete time in 19 days

issue commentSodiumFRP/sodium-rust

Change IsLambda* trait structure

Hmmm, boilerplate can be solved with a macro, but I wonder how much complexity calling the two methods would add internally?

I'm discovering that this is a substantially harder problem to solve than a naively thought when I first posted (in hindsight this probably should not have been a surprise). I have a few other directions that might pan out, but I think I may have to seek from more experienced Rustaceans on whether it's possible to do what I'm aiming for and how to implement it cleanly. It might also be the case that the issue with type inference is not coming from the trait indirection of the IsLambda* traits, but actually the & restriction on the arguments, I'll keep exploring and hopefully come back with some more concrete ideas.

RadicalZephyr

comment created time in 20 days

push eventRadicalZephyr/sodium-rust

Geoff Shannon

commit sha 547ae5969f10b811c45e64a091842fb1315688f2

Move sodium tests directly into main test module

view details

push time in 20 days

issue commentSodiumFRP/sodium-rust

Change IsLambda* trait structure

Will Rust let us implement Fn or FnMut for our own types anyway? Such as Lambda. Last time I tried, Rust would not let me. Admittedly I was on an older version of Rust at the time. @clinuxrulz

ooh, that is a very good question. perhaps not. another thing that would need to be experimented with.

RadicalZephyr

comment created time in 20 days

push eventRadicalZephyr/relm

Geoff Shannon

commit sha a73408f78c767a146f05729f226b6fc65149008d

Remove unused dependencies

view details

Geoff Shannon

commit sha 0783a53e8145e8a29a8f41213905f3651aedb994

Add crossbeam-channel as an optional dependency

view details

Geoff Shannon

commit sha c5d4eab07410ada144e92990e32b3d291fefe00d

Enable changing the type of the underlying channel in relm::Channel

view details

push time in 20 days

create barnchRadicalZephyr/relm

branch : crossbeam-channels

created branch time in 20 days

push eventRadicalZephyr/relm

Antoni Boucher

commit sha 5e01183a72d4384116d01ad9b34bae804a4965fa

Update to gtk-rs 0.9

view details

Antoni Boucher

commit sha 6fee0e78ad3bd497132e601e5551ba6986c14cdf

Fix test library

view details

antoyo

commit sha 0dc80e65d4c03ade0409ae932e270c53ddae3833

Merge pull request #225 from antoyo/feature/gtk-0.9 Update to gtk-rs 0.9

view details

-̸̧̧̠͉̖͇͕̞̳́̑̓̌̽͊͐͛͜͜ ræna►̵̡̡̙̞͉̞̺̖̖̪͔̹̘̌̑̔̚͝ͅ╜̵̧̪͙̥̤̖̫̹̗͖͎̻̱̎̆̽͂͐̀̒̊̉̕͝͝

commit sha 62fb1fb9a3ee0530d7bff6a4b81aef368ef1eab5

Add relm::connect so that example can run

view details

antoyo

commit sha a16a3bffd8bf22aca3c43c341e840d2deaa60619

Merge pull request #227 from xipi2048/patch-1 Add relm::connect so that README example can run

view details

push time in 20 days

issue commentSodiumFRP/sodium-rust

Change IsLambda* trait structure

I submitted a couple PRs with conceptually distinct sets of changes I've made on my fork. If you don't mind, I think I will also take your above comments and make issues for each of them to track the work on each individually.

I also have been thinking about the usage of Fn versus FnMut more, and I think that adding an extra hoop to jump through in order to do mutation inside of a sodium function like you describe would be valuable. As I mentioned in my first comment, a user could still do the kind of mutable update to a collection that you describe wanting to allow, they would just have to wrap their type inside an Arc<Mutex<...>> in order to do mutation inside one of the functions in an ostensibly side-effect free context. This could then transparently return an immutably borrowed version that doesn't expose the Mutex to other parts of the code. At least I'm pretty sure this would work, I'll have to experiment with it a bit to make sure.

This change would also be in keeping with Rust's general design ethic of being safe/immutable by default but allowing mutation, or unsafety escape hatches with more explicit syntax. I think there could be room for adding a new helper function to facilitate the boilerplate related to using this pattern for mutable update. As you say, that would definitely be a breaking change to the API so I'm not in a rush to make it.

I also think there is another breaking change that could result in a significant improvement in using Sodium. I believe the IsLambda* traits block type inferencing from working as it normally does when passing closures to functions that use those traits as a bound.

It looks like part of the reason for having the IsLambda* traits is to allow retrieving the dependency information from them with the deps_op method. A more idiomatic Rust trait design would probably be to have that method be in a separate trait, let's call it Deps, which could then be implemented for both the Lambda types and for the built-in Fn types. Then the places where IsLambda is used as a bound could use a combined bound of Fn(...) + Deps and this would (I believe) make type inferencing work correctly on closures passed to sodium methods.

I think related to this change, there is another benefit to using the Fn bound instead of FnMut. The other obvious thing that I can see the IsLambda traits currently do is enforce that all the arguments to the FnMut closures are passed as immutable references (which, side-note, I wonder if this might block implementing the collection mutation pattern you presented earlier? more tests!). By using Fn we get this bound automatically and can take away the & in the Fn bounds, which I think might actually be the source of the type inferencing problem.

RadicalZephyr

comment created time in 21 days

push eventRadicalZephyr/sodium-rust

Geoff Shannon

commit sha 9ed3e38db4b5172edddfadf27424212aa46af0b1

Replace usage of Mutex<usize> with AtomicUsize in SodiumCtx

view details

push time in 21 days

PR opened SodiumFRP/sodium-rust

Minor cleanups

This is a whole host of minor cleanups mostly reported by Clippy, but a few other things that I just noticed could be simpler.

All of these changes are essentially syntactic differences, and moving the code to use more Rust idioms, remove unneeded code, or make the types used more efficient (fewer pointers) or less unnecessarily restrictive.

I tried to separate the changes into different commits fixing only one kind of error in order to make it easier to review, so it might help to view each commit separately rather than the whole diff at once.

Since this PR fixes or silences all of the outstanding warnings from Clippy, I also made warnings fail in the clippy invocation in CI.

I also changed the clippy invocation to use the actions-rs/clippy-check action. This might be the most controversial change I made, since it requires using the Github token. The upside is that you get a much more nicely formatted presentation of any clippy warnings that are found.

+159 -131

0 comment

15 changed files

pr created time in 21 days

push eventRadicalZephyr/sodium-rust

Geoff Shannon

commit sha e3d6c787ce7747644b34674f97378672eb8fb699

Make clippy warnings fail CI and change to using clippy-check action

view details

push time in 21 days

PR opened SodiumFRP/sodium-rust

Port tests

Translate some of the commented out tests from typescript(?) into Rust. This is maybe partial work on #11?

I also moved all of the Sodium related tests into one tests file as you mentioned in #48. I left the mem_test and node_test as separate modules because they don't seem as related to the core of Sodium.

+1215 -1157

0 comment

6 changed files

pr created time in 21 days

push eventRadicalZephyr/sodium-rust

Geoff Shannon

commit sha 0f8d8b2bb772a1af91f772a56b6efa5e477bb310

Remove unneeded lifetime parameters from IsLambda* traits

view details

Geoff Shannon

commit sha 5d92609c1c7a166c49a120c860ebe1eda20eb2dd

Remove unneeded mut qualifiers in tests

view details

Geoff Shannon

commit sha d89644d739758142f35558c3f840395646b4135f

Add some trivial Default implementations

view details

Geoff Shannon

commit sha 5d7ae988c276e3948747426af03f97734c795be3

Use simplified struct constructor syntax

view details

Geoff Shannon

commit sha 51bb2ce935e2f07905b82eb398aef8fd5e69a90c

Remove unneeded explicit return statements

view details

Geoff Shannon

commit sha 23651ba4fcfa2c57d38ed313133544669a970702

Remove unnecessary clones

view details

Geoff Shannon

commit sha 6235fdbd10b03b6fd977ef4a39a96f475273a267

Use operator-assign operators for updating values

view details

Geoff Shannon

commit sha 10008ea045ca163829242e22b5dc22ca78e1dc3c

Use cloned/copied methods instead of mapping clone explicitly

view details

Geoff Shannon

commit sha 636b235ec9a51189169143ecbaf54255f8e9326e

Change borrowed Vec argument types to be slices instead

view details

Geoff Shannon

commit sha dd3b329f184b59184ce73ecf7eddf148792eb7fd

Break up ThreadSpawner spawn_fn type signature with an alias

view details

Geoff Shannon

commit sha 894da3b8b5bb5e12e473b7d918f7411b5189967f

Remove unneeded nesting in else

view details

Geoff Shannon

commit sha 5cf6b4da43e147f7c07fcda6678040af6bbe24f2

Fix several minor clippy lints - Ignore two lints that aren't desirable or possible to fix - Remove unneeded &mut from a match - Remove unneeded empty string from writeln - Remove errant end of line whitespace

view details

push time in 21 days

issue commentozkar99/cm-telemetry

Code Structure Review (from Reddit)

Heh, no worries, I enjoy reviewing code and it's a more productive way to procrastinate than scrolling reddit.

The type system is also a big part of what brought me to Rust! It's such a pragmatic language, where you can write nice functional idioms but also get really precise control over how memory is used! I sometimes want to be able to work at a slightly higher level where I can just have a GC and toss around references to everything, but I would want that to integrate really nicely with Rust. My (pipe) dream language is porting Clojure to be hosted on Rust. One day...

RadicalZephyr

comment created time in 21 days

push eventRadicalZephyr/sodium-rust

Geoff Shannon

commit sha babc4adc17ab825a661f00754a1549a71afc4c88

Move all sodium tests into one tests file

view details

push time in 21 days

create barnchRadicalZephyr/sodium-rust

branch : port-tests

created branch time in 21 days

create barnchRadicalZephyr/sodium-rust

branch : minor-cleanups

created branch time in 21 days

push eventRadicalZephyr/sodium-rust

push time in 21 days

issue commentSodiumFRP/sodium-rust

Change IsLambda* trait structure

Ah, that makes sense! I guess if I'm going to work on Sodium I should probably read and understand that "Denotational Semantics" appendix.

I would be happy to help out, I'm definitely interested in using sodium-rust for a few projects and I would love to help out. I'll separate out the other fixes on my branch from the lambda change and submit those as a pull request and take a look at porting and re-organizing the tests.

RadicalZephyr

comment created time in 21 days

issue openedozkar99/cm-telemetry

Code Structure Review (from Reddit)

Hey, I thought responding here might make more sense than on Reddit.

Looking a little more closely at your code, it seems like you have a lot of file/folder structure for not very much code. Given your project it seems like you are planning to add support for a lot more games. I think the dirt module makes sense in that case, but there are a few ways you could make the structure more idiomatic.

Using the mod.rs filename style is a bit of a legacy thing. The newer style is to use dirt.rs in the root of src/. Also, it's very strange to me that you have a module named dirt::dirt, I would just put the contents of dirt/dirt.rs into dirt.rs and then keep the event submodule if you want. I would likely put the event stuff directly in the dirt module so that you can have fewer folders.

If you want a bit more structure, I might make a root games module, and then make the code for each game a submodule of that, so it would become games/dirt.rs.

I also think the content of net.rs could just be in lib.rs. It looks like you've done a lot of Ruby and Go before this. I know Rubyists tend to prefer shorter files with one type per file, but part of that is because Ruby code is hard to refactor. One of the benefits of Rusts type system is that refactoring is much safer, and having more code in one file tends to be less of a problem. You also end up needing to write more types often, and sometimes they are only for use internally to the module where they are defined. The heuristic I use is to make one module per "concept" that typically exports only one or two types to be used by other modules.

In general it's pretty unusual to see a module that has no code in it that just declares submodules, it just adds extra files for no real benefit. One thing that you may not be aware of regarding use statements inside a single crate. You can import any type from any module and two modules can import types from each other, rustc will resolve it all just fine. So there's no need to introduce module structure to make imports more consistent or make them work or anything.

Let me know if you have any specific questions about these thoughts, it looks like a good start though! And welcome to Rust! It's a great language and a pretty great community, come join us on the official community spaces.

created time in 22 days

Pull request review comment7hoenix/7roxy

Process Answers from StackOverflow (with user input) and then create search links

 pub mod http {+    use libxml::parser::Parser;+    use libxml::xpath;     use std::error::Error;+    use std::io;+    use std::io::Write;+    use std::process::Command;      pub mod stack_exchange {+        use serde::Deserialize;+         pub enum Site {             StackOverflow,         }++        //+        // NOTE:+        // These types are from [here](https://api.stackexchange.com/docs/wrapper).+        //++        #[derive(Deserialize, Debug)]+        pub struct Response<I> {+            pub items: Vec<I>,+        }++        #[derive(Deserialize, Debug)]+        pub struct Question {+            pub question_id: u64,+        }++        #[derive(Deserialize, Debug)]+        pub struct Answer {+            pub answer_id: u64,+            pub body: String,+        }     }      pub enum Target {         StackExchange(stack_exchange::Site),     } +    fn process_answers(+        answers: stack_exchange::Response<stack_exchange::Answer>,+    ) -> Result<Vec<String>, Box<dyn Error>> {+        let stdin = io::stdin();+        let mut results: Vec<String> = Vec::new();+        for answer in answers.items {+            let parser = Parser::default_html();+            let document = parser+                .parse_string(answer.body.as_bytes())+                .expect("HTML document");+            let mut context = xpath::Context::new(&document).expect("HTML document context");++            for snippet in context+                .findnodes("//pre/code", None)+                .expect("XPath selector")+            {+                let content = snippet.get_content();+                println!("Found some code!");+                for (index, line) in content.lines().enumerate() {+                    println!("{: >3}: {}", index /* padded with spaces */, line);+                }+                print!("\n\nSearch GitHub for a line? Legend: s for next answer. Enter to skip snippet. ctrl-d to finish: ");+                io::stdout().flush().unwrap();+                let input = &mut String::new();+                stdin.read_line(input)?;+                if input.is_empty() {+                    return Ok(results); // Ctrl-D+                } else if input == "s\n" {+                    break;+                }+                match input.trim().parse::<usize>() {+                    Err(_) => {} // Just continue processing more answers!+                    Ok(i) => {

I don't know why clippy isn't suggesting this, but you should use an if let Ok(i) { ... } for this since you are ignoring the error case.

7hoenix

comment created time in 24 days

Pull request review comment7hoenix/7roxy

Process Answers from StackOverflow (with user input) and then create search links

 pub mod http {                     ("sort", "activity"),                     ("q", &search),                     ("site", "stackoverflow"),+                    ("accepted", "true"),+                    ("closed", "false"),                 ];                 let request = client                     .get("https://api.stackexchange.com/2.2/search/advanced")                     .query(&params);-                 let response = request.send().await?;+                let payload: stack_exchange::Response<stack_exchange::Question> = response+                    .json()+                    .await+                    .expect("StackOverflow questions HTTP response");+                let question_ids: Vec<String> = payload+                    .items+                    .iter()+                    .map(|q| q.question_id.to_string())+                    .collect();+                let ids = question_ids.join(";");+                let url: String = format!(+                    "https://api.stackexchange.com/2.2/questions/{}/answers",+                    ids+                );+                let params = [("filter", "withbody"), ("site", "stackoverflow")]; -                let body = response.bytes().await?;+                let request = client.get(&url).query(&params);+                let response = request.send().await?;+                let answers: stack_exchange::Response<stack_exchange::Answer> =+                    response.json().await?;+                let results = process_answers(answers)?; -                let v = body.to_vec();+                //+                // NOTE:+                // The "open" command is likely MacOS specific.+                //+                Command::new("open").args(results).output()?;

It is mac specific, the command under most X windows linux systems is xdg-open. Probably the best way to capture this is to have a function for running open that takes just the results. and then calls the right command. Or, you could make a sub-module with just the "open" command name as a const value. That's a bit simpler actually.

7hoenix

comment created time in 24 days

Pull request review comment7hoenix/7roxy

Process Answers from StackOverflow (with user input) and then create search links

 pub mod http {+    use libxml::parser::Parser;+    use libxml::xpath;     use std::error::Error;+    use std::io;+    use std::io::Write;+    use std::process::Command;      pub mod stack_exchange {+        use serde::Deserialize;+         pub enum Site {             StackOverflow,         }++        //+        // NOTE:+        // These types are from [here](https://api.stackexchange.com/docs/wrapper).+        //++        #[derive(Deserialize, Debug)]+        pub struct Response<I> {+            pub items: Vec<I>,+        }++        #[derive(Deserialize, Debug)]+        pub struct Question {+            pub question_id: u64,+        }++        #[derive(Deserialize, Debug)]+        pub struct Answer {+            pub answer_id: u64,+            pub body: String,+        }

Isn't serde great? :+1:

7hoenix

comment created time in 24 days

pull request comment7hoenix/gtree

WIP: Draw the owl

Code golf time! I got the current implementation down to 26 total LOC between main.rs and lib.rs, not including blank lines basically with only the changes I describe in my review.

cat src/*.rs | sed '/^$/d' | wc -l
7hoenix

comment created time in 24 days

Pull request review comment7hoenix/gtree

WIP: Draw the owl

+use std::fs;+use gitignore;++pub fn print_gtree(entries: fs::ReadDir, gitignore: Option<gitignore::File>) -> std::io::Result<()> {+    for entry in entries {+        let dir = entry?;+        let mut ignore = false;++        if let Some(g) = &gitignore {+            match g.is_excluded(&dir.path()) {

I'm... not so sure of the quality of this gitignore library. Every invocation of this is_excluded method actually walks the entire directory tree below the directory containing the .gitignore file which is... bad. Like really truly amazingly bad. It's no good. Don't do it!

https://docs.rs/gitignore/1.0.6/src/gitignore/file.rs.html#48-83

Seriously, the implementation and API of this library is so offensive that I want to fork and basically rewrite it from scratch. :vomiting_face:

7hoenix

comment created time in 24 days

Pull request review comment7hoenix/gtree

WIP: Draw the owl

+use std::fs;+use gitignore;++pub fn print_gtree(entries: fs::ReadDir, gitignore: Option<gitignore::File>) -> std::io::Result<()> {+    for entry in entries {+        let dir = entry?;+        let mut ignore = false;++        if let Some(g) = &gitignore {+            match g.is_excluded(&dir.path()) {+                Ok(true) => {+                    ignore = true;+                },+                Ok(false) => {+                },+                Err(e) => {+                    println!("failing:{:?}", e);+                }+            }+        }

The REALLY cool thing about this is that a simpler version of this helper function would then be mappable across a Vec<gitignore::File> using Iterator::any.

7hoenix

comment created time in 24 days

Pull request review comment7hoenix/gtree

WIP: Draw the owl

-fn main() {-    println!("ello");++use gtree;+use std::fs;+use std::fs::File;+use gitignore;+use std::path::Path;++fn main() -> std::io::Result<()> {+    let maybe_file = File::open(".gitignore");+    match maybe_file {

It looks like this File::open and match is purely to check for the existence of the .gitignore, but you haven't actually dropped and closed the file so you end up with two handles to it I think. At the very least you actually open the File twice. This is fine but suboptimal.

What you can do instead is create the Path as below and then use Path::is_file to check for existence, then just pass the path directly to gitignore::File::new.

You could also not check for the existence of the file beforehand at all, and just use the Result returned from gitignore::File::new, and transform it into an Option with Result::ok and pass that directly into print_gtree.

7hoenix

comment created time in 24 days

Pull request review comment7hoenix/gtree

WIP: Draw the owl

-fn main() {-    println!("ello");++use gtree;+use std::fs;+use std::fs::File;+use gitignore;+use std::path::Path;++fn main() -> std::io::Result<()> {+    let maybe_file = File::open(".gitignore");+    match maybe_file {+        Ok(_) => {+            let gitignore_path = Path::new(".gitignore");+            let gitignore_from_lib = gitignore::File::new(gitignore_path).unwrap();

This is good for a prototype, but in the general case .gitignore files are allowed at any level of the repository so you need to handle looking for them and adding them to the list of checks for ignored files and then popping them off the stack as you recurse back out.

7hoenix

comment created time in 24 days

Pull request review comment7hoenix/gtree

WIP: Draw the owl

+use std::fs;+use gitignore;++pub fn print_gtree(entries: fs::ReadDir, gitignore: Option<gitignore::File>) -> std::io::Result<()> {+    for entry in entries {+        let dir = entry?;+        let mut ignore = false;++        if let Some(g) = &gitignore {+            match g.is_excluded(&dir.path()) {+                Ok(true) => {+                    ignore = true;+                },+                Ok(false) => {+                },+                Err(e) => {+                    println!("failing:{:?}", e);+                }+            }+        }

Instead of this explicit match on the status and mutating the ignore variable, you can use a couple useful APIs on Result and Option that you might not be used to from Elm.

First, Option::as_ref takes an owned Option<T> by &self and returns an Option<&T>. Option::and_then allows you to chain Optional values together taking a fn that takes the Some value as an argument, and Result::ok turns a Result<T, E> into an Option<T>. Finally, we have Option::unwrap_or which either produces the value contained in a Some or the default value which is the second argument.

Using all those you should be able to write a single if statement that has the two printlns currently in this function in each of the two branches. Since this method chain is likely to be a little bulky I would pull it out into a helper function too.

7hoenix

comment created time in 24 days

Pull request review comment7hoenix/gtree

WIP: Draw the owl

+use std::fs;+use gitignore;++pub fn print_gtree(entries: fs::ReadDir, gitignore: Option<gitignore::File>) -> std::io::Result<()> {+    for entry in entries {+        let dir = entry?;+        let mut ignore = false;++        if let Some(g) = &gitignore {+            match g.is_excluded(&dir.path()) {+                Ok(true) => {+                    ignore = true;+                },+                Ok(false) => {+                },+                Err(e) => {+                    println!("failing:{:?}", e);+                }+            }+        }+        if !ignore {+        } else {+            println!("{:?}", dir.file_name());+        }

Isn't this condition backwards?

7hoenix

comment created time in 25 days

Pull request review comment7hoenix/gtree

WIP: Draw the owl

+use std::fs;

https://crates.io/crates/walkdir

7hoenix

comment created time in 25 days

startedTimelyDataflow/abomonation

started time in 25 days

startedfrankmcsherry/columnation

started time in 25 days

delete branch RadicalZephyr/sodium-rust

delete branch : cell-tests

delete time in a month

delete branch RadicalZephyr/sodium-rust

delete branch : rework-lambdas

delete time in a month

push eventRadicalZephyr/sodium-rust

Geoff Shannon

commit sha 12b2cd8e918d8c38aafe6966aef18ddcfc41d079

Format everything with rustfmt

view details

Geoff Shannon

commit sha d301914124e27d9f4bb79939cdb909c888d9dfd6

Remove unneeded lifetime parameters from IsLambda* traits

view details

Geoff Shannon

commit sha 25db93574b45072705aa58ca197a2f922c7a73a7

Remove unneeded mut qualifiers in tests

view details

Geoff Shannon

commit sha 5203b67c2451ffab56185925675ba93886faf300

Translate snapshot test into Rust syntax

view details

Geoff Shannon

commit sha ecd70a51bd7713b47d94db043435233ccc6346b1

Translate values test into rust syntax

view details

Geoff Shannon

commit sha 363b26021e59d8057a21a716f68149dee01b9c91

Translate the send before listen cell test

view details

Geoff Shannon

commit sha 30d0348a4923de3788e9e0e7fe5c03c1b3e5a348

Translate cell lift test

view details

Geoff Shannon

commit sha 286fb8fa34a97f225b99516797593bc1ad87766f

Translate lift glitch test

view details

Geoff Shannon

commit sha 58de9cebe64c624c294299bcbb24231b337afe63

Translate lift_from_simultaneous test

view details

Geoff Shannon

commit sha 06fc2171e55de75b3672ca7187bd7a1cd3a7ccfd

Change underlyng lambda trait from FnMut to Fn

view details

Geoff Shannon

commit sha b713d5b5f87ef2aa83540ac78c84f893b87ad305

Add an impl for IsLambda1 for Arc-Mutex wrapped fns

view details

Geoff Shannon

commit sha 7ba20168926c4ef2029d7d45b6664bd1770aca74

Add apply combinator fns for Lazy

view details

Geoff Shannon

commit sha 2f8bd2a75ae938593df81a27ce77db489b6b94f3

Add IsLambdaMut and IsLambdaOnce traits and impls

view details

Geoff Shannon

commit sha 5a4b0a76f6a1215694dd4426ff66413925ecbaba

Use LambdaMut1 in Lazy

view details

Geoff Shannon

commit sha 5c3c56820b6a36f30a699777b53622f87dd0b948

Pass parameters to IsLambdaMut* by mut ref

view details

Geoff Shannon

commit sha 0360f8d1fd40dc296eca05c844fa9b85af708915

Change lazy to use a Once fn instead of a mut fn

view details

Geoff Shannon

commit sha 37553e08ed14f0b3679bd4f081d6a750774a259e

Change Lazy::apply2 to use IsLambdaOnce2

view details

Geoff Shannon

commit sha 609e15738cde0b6246db9176a3d02595f7bae327

Remove extraneous ?Sized bound on IsLambdaMut1

view details

Geoff Shannon

commit sha 399446d34c4ccad8fc75368fd9f53ed375e06814

Reimplement Cell::map to be lazy aware

view details

Geoff Shannon

commit sha ba80e9c96db15111af985f4af7164057861b95f4

Use Lazy::apply to clarify the intent of Cell::map

view details

push time in a month

create barnchRadicalZephyr/name-it

branch : main

created branch time in a month

create barnchRadicalZephyr/name-it

branch : master

created branch time in a month

created repositoryRadicalZephyr/name-it

A small static site naming idea generator

created time in a month

delete branch RadicalZephyr/relm

delete branch : crossbeam-channels

delete time in a month

Pull request review comment7hoenix/7roxy

Finder (Reqwest hitting StackExchange spike)

+pub mod http {+    use std::error::Error;++    pub enum Site {+        Site(String),+    }

I'm into it. I hadn't actually grasped that you were hitting the stackexchange api generally and that the site searched was a parameter and that's what this string represented. I think looking at it from a maintenance perspective, since more stack exchanges are created all the time the site-name is probably something that should eventually come from the client program so that a user can ask 7roxy to search any stackexchange site without having us having to mention every single SE site by name in the code.

7hoenix

comment created time in a month

Pull request review comment7hoenix/7roxy

Finder (Reqwest hitting StackExchange spike)

 pub async fn process(socket: TcpStream) {         .expect("invalid format from client");     let message: Message = serde_json::from_reader(bytes.as_ref()).expect("failed to read");     match message {-        Message::Dummy => println!("Got a Dummy message!"),+        Message::FindInformationOn(search) => {+            println!("Got a directive to find information on \"{}\"", search);+            let res = make_request(+                search,+                Target::StackExchange(Site::Site(String::from("stackoverflow"))),

So it might make sense to actually pull this from a Lazy<HashMap<&str, Target>> using the Lazy struct from once_cell.

7hoenix

comment created time in a month

Pull request review comment7hoenix/7roxy

Finder (Reqwest hitting StackExchange spike)

+pub mod http {+    use std::error::Error;++    pub enum Site {+        Site(String),+    }

This looks weird to me. I'm having a hard time imagining what other variants this enum could grow, and the fact that the enum name and variant name are the same is actually a clippy lint I think. I would just use a newtype struct like:

pub struct Site(String);

This has the nice benefit of being guaranteed by the compiler to be the same size as a plain String but with a new type for type checking.

7hoenix

comment created time in a month

Pull request review comment7hoenix/7roxy

Finder (Reqwest hitting StackExchange spike)

 pub async fn process(socket: TcpStream) {         .expect("invalid format from client");     let message: Message = serde_json::from_reader(bytes.as_ref()).expect("failed to read");     match message {-        Message::Dummy => println!("Got a Dummy message!"),+        Message::FindInformationOn(search) => {+            println!("Got a directive to find information on \"{}\"", search);+            let res = make_request(+                search,+                Target::StackExchange(Site::Site(String::from("stackoverflow"))),

I think this needs to eventually come from a HashMap<&str, Target> that is built from an external data source so that this set of capabilities isn't fully fixed.

7hoenix

comment created time in a month

push eventRadicalZephyr/audit-check

Geoff Shannon

commit sha 7c8ec6f86358903ba2d1cee9119db75641bdec66

Fix lints

view details

push time in a month

PR opened actions-rs/audit-check

Add an input for passing additional arguments to cargo audit call

As mentioned in #132 it would be useful to be able to pass extra command-line arguments to the cargo audit invocation.

I tried to model the changes on the way that the args input is handled in actions-rs/cargo. This is my first time using typescript however so please let me know if I'm doing anything suboptimal.

I was unable to run the formatting or linting tools because I apparently am unable to set up node/npm correctly, and the error I'm getting is apparently not searchable. Happy to make any changes requested.

Fixes #132.

+13 -4

0 comment

4 changed files

pr created time in a month

create barnchRadicalZephyr/audit-check

branch : extra-arguments

created branch time in a month

PR closed antoyo/relm

Crossbeam channels

Hi, I needed to make this change for the way that I'm communicating with a Relm app from other parts of the code, specifically I need the relm::Sender to be Send which apparently the std::mpsc::Sender is not. Crossbeam channels also have better performance, so it seems like a win to me.

I also noticed that Relm itself does not depend on quote so I removed it.

+5 -5

3 comments

2 changed files

RadicalZephyr

pr closed time in a month

pull request commentantoyo/relm

Crossbeam channels

Sure, that makes sense. I've done that already for my own usage. Would you be open to having the dependency be opt-in through a crate feature?

RadicalZephyr

comment created time in a month

push eventRadicalZephyr/home

Geoff Shannon

commit sha edb3f35bbf504f308d8a73951867a7492b912278

Add an alias for verbose dd

view details

Geoff Shannon

commit sha abedfc6ef76373fdf8f98e3b7279da67c24d686a

Add an alias for pushing the last command into the X clipboard

view details

Geoff Shannon

commit sha 95c59a68c7115e2c84835470698c4595e8820a7e

gitignore .mal-history globally

view details

Geoff Shannon

commit sha b210edb96e9f229d037ca7757ba067a3191fceac

Remove a tab

view details

push time in a month

startedChrisJohnsen/tmux-MacOSX-pasteboard

started time in a month

more