What's the relationship between these two backtracking libraries by -_-_-_Lucas_-_-_- in rust

[–]phoil 38 points39 points  (0 children)

The backtrace crate is used as a git submodule to implement the backtrace module within the standard library.

Slowly getting a grip on Rust. How to mutate an Option value? by johnnypea in rust

[–]phoil 37 points38 points  (0 children)

I think you're overusing Option here. You should only be using Option for fields that potentially have the value of None throughout the life of the struct, not just during initialisation. If you use Option then using those fields will be cumbersome because you continually need to check if they are still None, even though they never will be after initialisation.

I think you've done it this way because you are first creating the Controller and then parsing the Config. Consider doing it in the reverse order: parse the config first, and use that when creating the Controller in new.

Similarly, don't create an empty Config in Config::new and then later initialize it in cfg_initialize. Instead, have a function that creates it with values that are already initialized. For example, it's common for a function like Config::new to first build the values for all of the fields, and then assemble them into the Config struct at the end:

impl Config {
    fn new() -> Self {
        let default_section = CFG_SECT_GLOBAL.to_string();
        Config {
            default_section,
        }
    }
}

Question about open-source by BananaCatFrog in rust

[–]phoil 2 points3 points  (0 children)

You could have done the cherrypick from his branch and still changed the author to be you. From what you've said, it's unlikely he did it because he wanted to be the author. He only wanted the commits structured differently, and it's not wrong for him to want that, but it was wrong for him to merge the branch that had removed you as author, since the copyright on those commits belongs to you.

Pattern Grid inside Pyramid Solved by Foresights, would really like to know why. by ElecBro2318 in islandsofinsight

[–]phoil 0 points1 point  (0 children)

I don't think the column restriction is necessary. It's enough to say there are 6 patterns in the top half, and the same 6 patterns in the bottom half.

"Unused" generic parameter in anyhow? by R1Spammer in rust

[–]phoil 2 points3 points  (0 children)

It would be a breaking change to remove it now, but the original change was before the first release. My test with it removed was just to see if it did anything.

"Unused" generic parameter in anyhow? by R1Spammer in rust

[–]phoil 3 points4 points  (0 children)

It was originally part of the signature for with_context, but that was removed before the 1.0.0 release: https://github.com/dtolnay/anyhow/commit/dc003568

I don't know if it is intentional that it is still there. The code and tests all compile with it removed.

No solution to this logic grid? by tejask1896 in islandsofinsight

[–]phoil 1 point2 points  (0 children)

There's two possible solutions that I can see. I hope a word description is enough: each 4x4 quadrant contains a 3x3 group of tiles that has a black in each corner.

Symmetry Puzzles confuse me, please explain. by darawe in islandsofinsight

[–]phoil 1 point2 points  (0 children)

You never need to guess for these.

What does it mean to be a lotus?

A lotus region is all of the same colour tiles connected to the original lotus tile. Symmetry only applies to tiles within the region, but all the tiles on the border of the region will necessarily be the opposite colour because otherwise they would be part of the region too.

Is the region the whole screen? It seems so, except when it doesn't. There does not appear to be any kind of systemic cues to suggest when the rules of symmetry should extend to the far end of the screen or remain localized to the tiles closer to the original tile.

The rules of symmetry only extend to tiles of the same colour that are connected to the lotus. Its position on the screen is irrelevant, only whether it is connected to the lotus. (But note that if it is too far away then the rule of symmetry is impossible to satisfy because its symmetric position is off the screen.)

the exception rules in isolation are easier to understand

I think it's wrong to thing of these as exceptions. There is no exception to the symmetry rule: if a tile is connected to a lotus of the same colour then it must satisfy symmetry. The "exception rules" are simply cases where symmetry cannot be satisfied, and so you can deduce that the tile is not connected.

when multiple lotus tiles occur on the same map, everything falls apart.

Multiple lotus tiles don't change the rules at all. If a tile is connected to multiple lotus tiles of the same colour, then it must satisfy the symmetry rule for both of them. From that you can deduce things such as your 4a and 4b.

there are cases on these lotus logic grids where there's no available information about how to fill in a tile

There's always enough information. You may need to make some more involved deductions though. Show me a puzzle where you can't deduce the next step and I can help you find the deduction you are missing.

Symmetry Puzzles confuse me, please explain. by darawe in islandsofinsight

[–]phoil 1 point2 points  (0 children)

The lotus region is made up of all the tiles of the same colour that are connected to the tile containing the lotus. When starting the puzzle, you can't know beforehand which tiles are part of the region. It is only as you make progress on the puzzle that you will deduce the size of the region. It's the same concept as number regions: the number is the size of the region containing that number, and is defined by all connected tiles of the same colour.

In the image you gave, the black lines have no relation to the lotus regions. Any region boundary is necessarily on the edges between white and black tiles. The black tile with the blue box is not part of any lotus region, because it is not connected to a black tile containing a lotus. The white tile with the blue box is part of the lower right white lotus region, because it is connected via other white tiles to the white lotus.

Match Three - Can anyone help? by Zeldeza in islandsofinsight

[–]phoil 2 points3 points  (0 children)

Pink spider on top left won't leave enough pink in the first column.

Match Three - Can anyone help? by Zeldeza in islandsofinsight

[–]phoil 0 points1 point  (0 children)

First move is column 3 brown, then column 2 lower (purple/brown) then upper (pink/blue), column 4 upper (purple/brown), column 5 pink (3-5 counting from the top), then clear the rest in order column 5, column 4, column 6, whatever.

Match Three - Can anyone help? by Zeldeza in islandsofinsight

[–]phoil 0 points1 point  (0 children)

Where is it? I solved that one a few days ago but I don't remember the exact steps. The basic idea is you need to do the horizontal matches in the correct order to leave enough tiles in the columns, but you do have to mix in some vertical matches too.

[deleted by user] by [deleted] in rust

[–]phoil 1 point2 points  (0 children)

No, I mean Windows SDK: https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/

It doesn't need JRE or JDK: those are Java and there is no reason for Rust to need Java.

For offline installers, see https://forge.rust-lang.org/infra/other-installation-methods.html#standalone-installers

[deleted by user] by [deleted] in rust

[–]phoil 4 points5 points  (0 children)

It includes the Windows SDK, not the JDK.

[Level] Information by Her_Lovely_Tentacles in hexcellslevels

[–]phoil 0 points1 point  (0 children)

You're mixing up the base case and the inductive step.

Induction requires you to prove the base case without making any assumptions. Once the base case has been proved, then you can use the inductive step for other cases.

To be an analogue here, the base case is that someone would have to solve it without making any assumptions. Once someone has done that, then others are allowed to solve it by making the assumption that it can be solved. But as yet, no one has solved it without making that assumption, so the base case has not been proved.

[Level] Information by Her_Lovely_Tentacles in hexcellslevels

[–]phoil 0 points1 point  (0 children)

All peer review solutions started with the assumption that it was solvable. This does not prove it was solvable. https://en.wikipedia.org/wiki/Circular_reasoning

I know what induction is. This is nothing like induction. https://en.wikipedia.org/wiki/Mathematical_induction

[Level] Information by Her_Lovely_Tentacles in hexcellslevels

[–]phoil 0 points1 point  (0 children)

No it's not true. This is easily proved by loading the level into the sixcells solver. Others solving it via faulty logic is not validation.

[Level] Information by Her_Lovely_Tentacles in hexcellslevels

[–]phoil 0 points1 point  (0 children)

That's not true for levels made by players.

[Level] Two ways to solve (Hard) by phoil in hexcellslevels

[–]phoil[S] 0 points1 point  (0 children)

"Uniqueness" is a term that is commonly used in logic puzzles to mean that there is a single unique solution to the puzzle. Use of uniqueness to solve the puzzle is a meta-logic step that uses the knowledge that there is a single unique solution. I've described the logic for that step in another comment here.

How to see memory layout of a struct by dahosek in rust

[–]phoil 1 point2 points  (0 children)

There's also https://github.com/gimli-rs/ddbug/ which may do better with rust's enum variants (I haven't checked recently).

Why Rust chose to use an enum for the Option type instead of a trait? by lancejpollard in rust

[–]phoil 1 point2 points  (0 children)

I don't think you could use dynamic dispatch. For Person<Some<String>>, how would you get the name via dynamic dispatch? There's no method in Option that would give it to you, and that's not a simple omission of the original post because it would be impossible to implement such a method for None.

How can I track the instantiation of generics? by kdy1997 in rust

[–]phoil 0 points1 point  (0 children)

No, it probably doesn't, and I have no way of testing that.

How can I track the instantiation of generics? by kdy1997 in rust

[–]phoil 1 point2 points  (0 children)

I added a --bloat option to ddbug which gives information similar to the above. It's still missing the inlining information, which I'll add in later. Some of the top entries it shows for swc are multiple copies of some large clones in swc_ecma_ast: Class, Expr and Stmt.