Not a single person in this thread commented on the use of Date.now() and similar - surely clock.now() - you never ever want to use global time in any code, how could you test it?
clock in this case is a thing that was supplied to the class or function. It could just be a function: () -> Instant.
(Setting a global mock clock is too evil, so don't suggest that!)
I was just referring to how pipes make these kinds of chained function calls more readable. But on your point, I think using Date.now() is perfectly ok.
This is why we have tests which we need to update every 3 months, because somebody said this. This is of course, after a ton of research went into finding out why the heck our tests broke suddenly.
I would call those badly-written tests. The current date/time exists outside the system and ought to be acceptable for mocks, and in python we have things like freezegun that make it easy to control without the usual pitfalls of mocks.
What are those mock pitfalls, which are avoided by freezegun which is a mock according even to them? IoC and Clocks solve the same problem. So what are the pitfalls of using those instead of this other mock?
Agreed! But i didnt miss the example....
i also thought it was interesting that all the various examples of declarative or applicative did Date.now(), which i see as a big thing to avoid.
The nice thing with the Elixir example is that you can easily `tap()` to inspect how the data looks at any point in the pipeline. You can also easily insert steps into the pipeline, or reuse pipeline steps. And due to the way modules are usually organized, it would more realistically read like this, if we were in a BulkEmails module:
The nice thing here is that we can easily log to the console, and also filter out nil expiry emails. In production code, `generate_expiry_email/1` would likely return a Result (a tuple of `{:ok, email}` or `{:error, reason}`), so we could complicate this a bit further and collect the errors to send to a logger, or to update some flag in the db.
It just becomes so easy to incrementally add functionality here.
---
Quick syntax reference for anyone reading:
- Pipelines apply the previous result as the first argument of the next function
- The `/1` after a function name indicates the arity, since Elixir supports multiple dispatch
That's a really cool concept, I'd love to see more art like this that uses modern technology. Do you have a demo available somewhere to see what the effect would look like? This is one of those things where you should just do it without asking for permission. The portals[0] art installation in some cities doesn't ask for consent either.
Does this allow external programs/servers to interact with a workbook (xlsx file)? Or is this just to run more complex calculations inside cell(s)?
There's UNO and there's also openpyxl to interact with workbooks from Python, but both solutions were a bit slow when testing it.
There's a lot of value in having existing workbooks which a lot of businesses already use, and extending them so they can be interacted with or queried from a server. For example to allow further access from a webapp without allowing changes to the entire workbook or hiding the full dataset.
Full-stack web developer with 10+ years of professional experience. Creator of LiveSvelte, a popular library integrating Svelte with Phoenix LiveView. I'm looking for Elixir/Phoenix projects with a defined scope—preferably fixed-fee or milestone-based. Open to equity or profit-sharing arrangements for the right opportunity.
Memory is actually shared in Elixir until it's required to create new memory because of a change. So even if you have a big dictionary and something changes, part of the dictionary that remained the same will actually share memory until it's required to create new memory because of a change in that part of the dictionary.
So in effect, most immutable languages actually do copy by reference, it's just abstracted away for the programmer and you can reason about it as copy by value.
I can't find the article now but I remember reading about this and someone can probably link it.
I'm generally very pro EU, but this anti-encryption stuff they try to pull these last couple of years needs to stop. If it's proven that Pavel Durov is facilitating bad actors with purpose, that's a different story, but creating a secure messaging platform by itself should not constitute a crime.
Telegram is not a secure messaging platform. By default Telegram is not encrypted at all. Only "secret chats" in Telegram are encrypted. Telegram groups are not - and those can be made public and basically are just Telegram hosting content on their servers for you.
That's a popular lie, Telegram uses the MTProto 2.0 Cloud algorithm for non-secret chats, which is audited and verified by multiple independent parties. For example WhatsApp claims it uses EE2E encrypted chats, how ever these claims are unverified and not audited. Also their chief executives are not in jail, coincidentally.
You can consult these links if you want to read more about it:
This is a Ukraine channel. You can preview it in a web browser. If Telegram can enable that functionality, then it means they have the complete capability to serve the content of the channel. Same story if they can scroll back an existing channel to new users.
Channels were meant to be public. No-one ever claimed encryption for channels since it is nonsense.
You claim that only secret chats are encrypted in telegram, which is straight not true. You can pull up a link to public channel and everyone can preview the posts, that's obvious. You cannot do the same trick with group chats because they are private and encrypted using MTProto
MTProto is pretty much transport layer encryption. After the MTProto decryption occurs, Telegram servers still ultimately receive your unencrypted message encoded as a https://core.telegram.org/method/messages.sendMessage to send it to the recipient and to store it. How do you think it is possible that you can sign in on a new device and get all of your old messages? There's a reason Signal can't do that.
MTProto is not pretty much transport layer encryption, Telegram servers receive messages encrypted with an auth_key which is created during registration directly on the device and never exchanged via network. When you sign in on a new device, you have to communicate the keys with your other devices, and there is also a second-factor user defined recovery password in place, which is not stored or known to the telegram servers. If you loose your permament session you may be locked out of your account and data forever. Everything is documented at the links, audited and verified, and everything is possible - you can just read how it works.