workspace
stringclasses 4
values | channel
stringclasses 4
values | text
stringlengths 1
3.93k
| ts
stringlengths 26
26
| user
stringlengths 2
11
|
---|---|---|---|---|
elmlang | general | The key is that the server response/request objects are generated code | 2019-03-14T23:25:07.152800 | Rosaria |
elmlang | general | So modifying them or assimilating them into a completely flattened model isn't really feasible. | 2019-03-14T23:25:24.153200 | Rosaria |
elmlang | general | Nor desirable. | 2019-03-14T23:25:26.153400 | Rosaria |
elmlang | general | ok | 2019-03-14T23:25:31.153600 | Hoyt |
elmlang | general | They serialize back and forth, and encompass all the types the server understands. | 2019-03-14T23:25:58.154200 | Rosaria |
elmlang | general | It's a very nice model tbh. | 2019-03-14T23:26:00.154400 | Rosaria |
elmlang | general | I believe it | 2019-03-14T23:26:05.154600 | Hoyt |
elmlang | general | But when you go to update these objects inside your model | 2019-03-14T23:26:16.155000 | Rosaria |
elmlang | general | One of your eyes always twitches a few times | 2019-03-14T23:26:24.155400 | Rosaria |
elmlang | general | :slightly_smiling_face: your = my :slightly_smiling_face: | 2019-03-14T23:26:31.155600 | Hoyt |
elmlang | general | Different designs are optimized for different situations | 2019-03-14T23:27:33.157000 | Hoyt |
elmlang | general | Can I ask how you handle the problem for your own stuff? | 2019-03-14T23:28:08.157800 | Rosaria |
elmlang | general | You've mentioned abstractions | 2019-03-14T23:28:15.158100 | Rosaria |
elmlang | general | But that's fairly abstract. | 2019-03-14T23:28:19.158400 | Rosaria |
elmlang | general | I generally have a module representing working with whatever the nested value represents | 2019-03-14T23:28:32.158900 | Hoyt |
elmlang | general | If I find I need to update it, then I generally find I need to do other things with it | 2019-03-14T23:28:47.159400 | Hoyt |
elmlang | general | So, I usually end up with (and, of course, specific context matters) | 2019-03-14T23:29:00.159800 | Hoyt |
elmlang | general | ```
{ model | prop = Abstraction.doSomethingWith model.prop }
``` | 2019-03-14T23:29:20.160300 | Hoyt |
elmlang | general | There is usually a reason I’m updating a specific aspect of the nested structure. I try to map the update to that reason | 2019-03-14T23:29:44.160900 | Hoyt |
elmlang | general | But, again, very abstract explanation and it always comes down to the specific context of the codebase | 2019-03-14T23:30:06.161600 | Hoyt |
elmlang | general | Right. | 2019-03-14T23:30:11.161800 | Rosaria |
elmlang | general | So, there isn’t a “one size fits all” | 2019-03-14T23:30:18.162100 | Hoyt |
elmlang | general | but I will say that I don’t find myself needing `{ model.prop | attribute = newValue }` | 2019-03-14T23:30:35.162800 | Hoyt |
elmlang | general | Because my module’s “doSomethingWith” receives the `prop` and updates it | 2019-03-14T23:30:52.163400 | Hoyt |
elmlang | general | So, I don’t need the nested syntax | 2019-03-14T23:30:58.163700 | Hoyt |
elmlang | general | I try to build in terms of the behaviours, rather than the data, so I generally find myself with these functions | 2019-03-14T23:31:35.165000 | Hoyt |
elmlang | general | I’m sure there are impacts of this style in other aspects | 2019-03-14T23:31:51.165700 | Hoyt |
elmlang | general | that perhaps over-complicate things in other parts of my system. ¯\_(ツ)_/¯ So many trade-offs | 2019-03-14T23:32:07.166300 | Hoyt |
elmlang | general | Always is in programming. | 2019-03-14T23:32:24.166600 | Rosaria |
elmlang | general | for sure | 2019-03-14T23:32:28.166800 | Hoyt |
elmlang | general | Why I always try to say “there’s no best design, only better design for the context” | 2019-03-14T23:32:44.167400 | Hoyt |
elmlang | general | It's generated code, so we could generate the helpers as well. | 2019-03-14T23:33:47.168300 | Rosaria |
elmlang | general | It just seems like such a waste | 2019-03-14T23:33:50.168600 | Rosaria |
elmlang | general | Adding potentially thousands of helper functions, most of which would never be used | 2019-03-14T23:34:07.169100 | Rosaria |
elmlang | general | There are some utilities that generate the nested helpers, for sure | 2019-03-14T23:34:11.169300 | Hoyt |
elmlang | general | Add compile times etc. | 2019-03-14T23:34:14.169600 | Rosaria |
elmlang | general | Luckily we won’t compile in the functions that aren’t used | 2019-03-14T23:34:24.170000 | Hoyt |
elmlang | general | Does 0.19 do DCE? | 2019-03-14T23:34:45.170400 | Rosaria |
elmlang | general | My memory is fuzzy on that. | 2019-03-14T23:34:57.170800 | Rosaria |
elmlang | general | yeah | 2019-03-14T23:34:59.170900 | Hoyt |
elmlang | general | I see. | 2019-03-14T23:35:02.171100 | Rosaria |
elmlang | general | (as per my understanding) | 2019-03-14T23:35:08.171600 | Hoyt |
elmlang | general | yep, function and type level DCE | 2019-03-14T23:35:35.171900 | Earlean |
elmlang | general | In any case, thanks <@Rosaria> for the chat. I’m a bit drunk and ready for bed. :slightly_smiling_face: | 2019-03-14T23:36:33.172500 | Hoyt |
elmlang | general | I’m always intrigued by people’s thoughts on these things | 2019-03-14T23:37:23.173000 | Hoyt |
elmlang | general | I appreciate your explaining where youa re coming from | 2019-03-14T23:37:31.173400 | Hoyt |
elmlang | general | I'll probably gather a bunch of data and attempt to write a proposal on the Discourse. There's certainly enough data pointing to this as a problem. But unlike the verbosity of JSON decoders this one seems solvable to me. | 2019-03-14T23:38:01.174100 | Rosaria |
elmlang | general | Also thanks for the counter-example <@Earlean> | 2019-03-14T23:38:19.174600 | Rosaria |
elmlang | general | awesome. I’ll be interested in reading it. | 2019-03-14T23:38:29.175000 | Hoyt |
elmlang | general | There is definitely value in “I design this way, because this is the facility I have” | 2019-03-14T23:38:58.176000 | Hoyt |
elmlang | general | It's been something that has been discussed for a few years now and Evan doesn't seem interested in changing it | 2019-03-14T23:39:18.176800 | Earlean |
elmlang | general | Or, rather, “definitely something there” | 2019-03-14T23:39:20.176900 | Hoyt |
elmlang | general | I like hearing people’s thoughts on it | 2019-03-14T23:39:34.177800 | Hoyt |
elmlang | general | <@Earlean> Ahh, the benevolent dictator. Only so benevolent I suppose. | 2019-03-14T23:39:43.178300 | Rosaria |
elmlang | general | It often boils down to people’s design philosophies, so I like hearing them. | 2019-03-14T23:39:52.178700 | Hoyt |
elmlang | general | Whether it is leading to a change or not | 2019-03-14T23:39:59.179000 | Hoyt |
elmlang | general | `{myRecord.data | field = value}` (where it returns `data`) not working was originally considered a bug in the compiler | 2019-03-14T23:40:14.179500 | Earlean |
elmlang | general | <@Hoyt> I like these sorts of discussions too, as a kind of language nerd myself. | 2019-03-14T23:40:21.179700 | Rosaria |
elmlang | general | and was not fixed because it was considered that code doing that was worse code | 2019-03-14T23:40:44.180200 | Earlean |
elmlang | general | <@Earlean> And how about code that's returning `myRecord` instead? Does that make it better? :smile: | 2019-03-14T23:41:20.180800 | Rosaria |
elmlang | general | it was generally considered to be a bit of a confusing thing to do `{myrecord | ...}` updates `myrecord`, but `{myRecord.data| }` doesn't update `data`, that's weird... | 2019-03-14T23:42:58.182500 | Earlean |
elmlang | general | should `{(someFunction someValue) | field = value}` work? | 2019-03-14T23:43:33.183100 | Earlean |
elmlang | general | if so, what part of the value does the update apply to? | 2019-03-14T23:43:54.183600 | Earlean |
elmlang | general | do we need some other different syntax for when I want to update `myRecord.data` without first assigning `myRecord.data` to a variable in a `let`? | 2019-03-14T23:45:04.184800 | Earlean |
elmlang | general | if Elm supports both cases then won't people get them confused | 2019-03-14T23:45:56.185900 | Earlean |
elmlang | general | just latching on to the last part of the convo, i would love to see a setter syntax just like how we currently have the getter `.` syntax | 2019-03-14T23:45:56.186000 | Ruthann |
elmlang | general | <@Ruthann> I think everyone would love that :stuck_out_tongue: | 2019-03-14T23:49:56.188300 | Rosaria |
elmlang | general | ```
setData: a -> {b | data: a} -> b
setData a b = {b | data = a}
(setData someData myRecord)
``` | 2019-03-14T23:50:31.188900 | Earlean |
elmlang | general | <@Earlean> But it does update `data`. But immediately it assigns that to `myRecord.data` as it's specified there in the update statement. But it returns `myRecord` because ultimately you have modified that. And if you do not return that, you've lost part of your update. | 2019-03-14T23:51:14.189900 | Rosaria |
elmlang | general | Also I would think that `{(someFunction someValue) | field = value}` is outside of the scope of this conversation | 2019-03-14T23:52:26.191100 | Rosaria |
elmlang | general | <@Rosaria> yeah, but why should it do that? I passed the `data` value to it, why should it care about `myRecord`? | 2019-03-14T23:52:34.191500 | Earlean |
elmlang | general | <@Earlean> You passed `myRecord's` `.data` to it. Therefore it must care. | 2019-03-14T23:52:55.191900 | Rosaria |
elmlang | general | It depends how you perceive the `{ | }` syntax I suppose. | 2019-03-14T23:53:26.192700 | Rosaria |
elmlang | general | ```
let
data = myRecord.data
in
{data | field = value}
```
^ data is the same value there | 2019-03-14T23:53:55.193600 | Earlean |
elmlang | general | To me I find it a magical beast that defies the very nature of Elm. It barely has a place in the language. It works with almost no constructs that work everywhere else in Elm. | 2019-03-14T23:53:55.193700 | Rosaria |
elmlang | general | Right, but at that point you're only passing data | 2019-03-14T23:54:07.194000 | Rosaria |
elmlang | general | And it would only return data | 2019-03-14T23:54:11.194200 | Rosaria |
elmlang | general | And if you wanted it to behave that way, that's the code you would write. | 2019-03-14T23:54:17.194500 | Rosaria |
elmlang | general | I believe that that use case is far less used (though I'd have to get the data to prove that) | 2019-03-14T23:54:35.195200 | Rosaria |
elmlang | general | what if I wanted the above behaviour? would I have to do the `let..in`? | 2019-03-14T23:54:45.195700 | Earlean |
elmlang | general | Yep. As you have to do now. | 2019-03-14T23:54:56.196000 | Rosaria |
elmlang | general | Since no `.` is accepted anywhere in the record update syntax. | 2019-03-14T23:55:08.196300 | Rosaria |
elmlang | general | so why one behaviour instead of the other? | 2019-03-14T23:55:21.196600 | Earlean |
elmlang | general | > I believe that that use case is far less used (though I'd have to get the data to prove that) | 2019-03-14T23:55:39.197000 | Rosaria |
elmlang | general | I'd actually like to see the data | 2019-03-14T23:55:52.197200 | Rosaria |
elmlang | general | I wonder if it's possible to comb some elm repositories | 2019-03-14T23:56:02.197500 | Rosaria |
elmlang | general | Looking for these exact patterns | 2019-03-14T23:56:05.197700 | Rosaria |
elmlang | general | And produce meaningful statistics on it. | 2019-03-14T23:56:13.197900 | Rosaria |
elmlang | general | I'd additionally say that, it's harder to do the opposite if you want it. Consider the two use cases:
```
-- Update nested data
let data = myRecord.data
newData = { data | thing = 5 }
in { myRecord | data = newData }
-- Update nested data without updating each level of nest
let
data = myRecord.data
in
{data | field = value}
``` | 2019-03-14T23:58:16.199900 | Rosaria |
elmlang | general | This of course becomes even more clear when you have more levels of nesting (though I still discourage deeply nested hierarchies) | 2019-03-14T23:58:49.200400 | Rosaria |
elmlang | general | ```
let
data = myRecord.data
in
{ myRecord | data = { data | thing = 5 } }
``` | 2019-03-15T00:00:08.202000 | Earlean |
elmlang | general | Ah of course. Silly me. | 2019-03-15T00:00:47.202400 | Rosaria |
elmlang | general | 3 levels deep and I'd agree, but at that point you're writing worse code | 2019-03-15T00:01:23.203200 | Earlean |
elmlang | general | Perhaps. Perhaps not. Sometimes it might not even be something you wrote! | 2019-03-15T00:02:07.203900 | Rosaria |
elmlang | general | But regardless, those are the reasons that I'd choose one return over the other. | 2019-03-15T00:02:17.204200 | Rosaria |
elmlang | general | I think one has genuinely more impact and utility. | 2019-03-15T00:02:25.204500 | Rosaria |
elmlang | general | Whereas the other is less frequently used and easier to deal with when it does arise | 2019-03-15T00:02:37.204900 | Rosaria |
elmlang | general | And I'm happy to have someone call me out for a lack of data on that | 2019-03-15T00:02:48.205400 | Rosaria |
elmlang | general | It's just my anecdotes. | 2019-03-15T00:02:57.205700 | Rosaria |
elmlang | general | It's also one of those things where it's not a lot of code..but if it is then you write a function and use that function | 2019-03-15T00:02:59.205800 | Earlean |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.