Forwarded from Блог*
#prog #article
Системы типов #java и #scala являются unsound. Подробности в статье.
TL;DR:
Программа определяет тип
И эта ошибка оставалась незамеченной 12 лет. А кто-то ещё говорит, что null — хорошая идея.
Системы типов #java и #scala являются unsound. Подробности в статье.
TL;DR:
Программа определяет тип
class Constrain<A, B extends A> {} и метод upcast:static class Bind<A> {
<B extends A>
A upcast(Constrain<A,B> constrain, B b) {
return b;
}
}
Этот метод просто апкастит значение типа B в значение типа A, используя значение типа Constrain<A, B> как материальное свидетельство того, что B действительно является подтипом A. К сожалению, ничто не мешает в качестве значения этого типа использовать null, что ломает логику системы типов, которая полагается на этот факт, а использования wildcard capture позволяет при помощи Constrain установить отношение субтипизации между двумя произвольным типами. Результат? Комбинация null-гого Constrain и upcast позволяет перевести значение любого типа в значение любого типа. Фактически — аналог std::mem::transmute, но без каких либо небезопасных фич и с корректно типизированным кодом.И эта ошибка оставалась незамеченной 12 лет. А кто-то ещё говорит, что null — хорошая идея.
#meme
Спасибо @neftedollar за наводку)
Оригинал: https://twitter.com/a_kapustin/status/1440984303182258177?s=21
Спасибо @neftedollar за наводку)
Оригинал: https://twitter.com/a_kapustin/status/1440984303182258177?s=21
#prog #dotnet
В статье рассказывается о поддержке HTTP/3 в .NET 6
https://devblogs.microsoft.com/dotnet/http-3-support-in-dotnet-6/
В статье рассказывается о поддержке HTTP/3 в .NET 6
https://devblogs.microsoft.com/dotnet/http-3-support-in-dotnet-6/
Microsoft News
HTTP/3 support in .NET 6
See how to use HTTP/3 in your apps built using .NET 6.
#prog
GitPod запускает OSS версию VS Code сервера (считай, self-hosted версия GitHub CodeSpaces)!
Блог GitPod: https://www.gitpod.io/blog/openvscode-server-launch
Собсно репа: https://github.com/gitpod-io/openvscode-server/
GitPod запускает OSS версию VS Code сервера (считай, self-hosted версия GitHub CodeSpaces)!
Блог GitPod: https://www.gitpod.io/blog/openvscode-server-launch
Собсно репа: https://github.com/gitpod-io/openvscode-server/
www.gitpod.io
VS Code in the browser for everyone - Blog
Run the latest VS Code on a remote machine accessed through a modern web browser - from any device, from anywhere.
Forwarded from Находки в опенсорсе
⚡️ Breaking news!
Python3.10 was released several hours ago (not so breaking news, right?). One of the main new features is pattern matching.
Today, I am releasing
Cool, isn't it? Today Python made one more giant step for better functional programming support. And no doubt, that
Check out our:
- Docs: https://returns.readthedocs.io/en/latest/pages/result.html#pattern-matching
- Release notes: https://github.com/dry-python/returns/releases/tag/0.17.0
- Python3.10 release notes: https://docs.python.org/3.10/whatsnew/3.10.html
Soon we will be adding pattern matching support for mypy as well. So, it would be type checked correctly.
Big day for #python!
Python3.10 was released several hours ago (not so breaking news, right?). One of the main new features is pattern matching.
Today, I am releasing
dry-python/returns@0.17.0 with full pattern matching support. Here's an example of how you can use it together with Result type:from returns.result import Failure, Success, safe
@safe
def div(first_number: int, second_number: int) -> int:
return first_number // second_number
match div(1, 0):
# Matches if the result stored inside `Success` is `10`
case Success(10):
print('Result is "10"')
# Matches any `Success` instance and binds its value to the `value` variable
case Success(value):
print('Result is "{0}"'.format(value))
# Matches if the result stored inside `Failure` is `ZeroDivisionError`
case Failure(ZeroDivisionError):
print('"ZeroDivisionError" was raised')
# Matches any `Failure` instance
case Failure(_):
print('The division was a failure')
Cool, isn't it? Today Python made one more giant step for better functional programming support. And no doubt, that
dry-python is the first one to officially support it.Check out our:
- Docs: https://returns.readthedocs.io/en/latest/pages/result.html#pattern-matching
- Release notes: https://github.com/dry-python/returns/releases/tag/0.17.0
- Python3.10 release notes: https://docs.python.org/3.10/whatsnew/3.10.html
Soon we will be adding pattern matching support for mypy as well. So, it would be type checked correctly.
Big day for #python!