protocols Questions
2
Solved
Python's PEP 544 introduces typing.Protocol for structural subtyping, a.k.a. "static duck typing".
In this PEP's section on Merging and extending protocols, it is stated that
The general...
Wainscot asked 7/7, 2020 at 4:49
4
I'm hitting an issue that would be easily solved by intersection types (currently under discussion but not yet implemented) and was wondering what the cleanest workaround is.
Current setup and prob...
Allargando asked 13/1, 2022 at 14:10
11
When using @Published property wrapper following current SwiftUI syntax, it seems very hard to define a protocol that includes a property with @Published, or I definitely need help :)
As I'm imple...
3
Solved
Is it possible to have a Protocol require that an enum be defined?
//trying to do this
protocol JSONEncodable {
enum PropertyName // Type not allowed here
func valueForProperty(propertyName:Prop...
1
Solved
protocol EmptyInitializable {
init()
}
@propertyWrapper
struct PropertyWrapper: EmptyInitializable {
let wrappedValue: Int
init(_ wrappedValue: Int = 0) {
self.wrappedValue = wrappedValue
}...
Igneous asked 24/4 at 5:31
0
Accidentally stumbled upon an interesting post.
In a nutshell:
protocol Unknownable {
static var unknown: Self { get }
}
enum Type: Unknownable {
case text
case image
case document
case unkno...
Apologize asked 24/4 at 6:4
3
Solved
I would like help with recursively looping over all attributes/sub objects contained in a protocol buffers message, assuming that we do not know the names of them, or how many there are.
As an exa...
Siskin asked 19/3, 2015 at 15:16
5
Solved
I usually pass data between my web servers (in different locations) using HTTP requests (sometimes using SSL if it's sensitive). I was wondering if there were any lighter protocols that I might be ...
3
Solved
I'm working on a javascript front end site to run in the browser [Chrome], and I'd like to launch Word on the clients PC with their selected macros that have already been setup in Word for them on ...
Perfervid asked 10/4, 2014 at 11:40
1
Solved
I'd like to type hint that a pandas dataframe must have a datetimeindex. I was hoping there might be some way to do this with protocols but looks like no. Something in the spirit of this:
class TSF...
3
Solved
The questions below are intended to be serious rather than frivolous. I lack experience in distributed systems, but I do understand how Basic Paxos works and why leader selection is useful. Unfortu...
Samite asked 22/5, 2014 at 5:49
7
Solved
Question about the MAC-protocol of 802.11 Wifi.
We have learned that when a station has received the data it waits for SIFS time. Then it sends the packet. When searching online the reason that is...
Buehler asked 8/1, 2010 at 20:44
4
Solved
In the following code, I want to test if x is a SpecialController. If it is, I want to get the currentValue as a SpecialValue. How do you do this? If not with a cast, then some other technique.
Th...
Durante asked 2/11, 2016 at 19:12
6
Solved
I'm hoping someone can clarify to me the technical difference between a protocol and a scheme in a url. (or identify the rest of the items that can also be placed in a scheme?)
Originally I had th...
Antidromic asked 23/2, 2018 at 17:31
5
Solved
I want to create a protocol that enforces a certain case on all enums conforming to this protocol.
For example, if I have a enum like this:
enum Foo{
case bar(baz: String)
case baz(bar: String...
4
Solved
I am not very clear about the idea of wire-level protocols. I heard BitTorrent uses it and read that a wirelevel protocol can be considered an opposite of API. I read RMI calls can be considered wi...
Erminna asked 24/2, 2010 at 6:23
9
Solved
I followed this thread: datepicker by clicking on textfield
I imported both of the following protocols:
@interface ViewController : UIViewController<UIActionSheetDelegate, UITextFieldDelegate&...
Rimola asked 25/6, 2012 at 21:48
1
I am using a proxy to request API related to payment in the backend.
API proxy requests are made using the HTTP protocol.
User-sensitive data is delivered when API requests are made.
In the case of...
Vevine asked 13/11, 2023 at 8:50
6
Solved
I would like to send the HEAD command of the Hypertext Transfer Protocol to a server in PHP to retrieve the header, but not the content or a URL. How do I do this in an efficient way?
The probably...
2
In Python, I have two protocols, one of which inherits from the other:
class SupportsFileOperations(Protocol):
...
class SupportsMediaOperations(SupportsFileOperations):
...
I then have a coupl...
Alita asked 31/10, 2021 at 1:42
3
How do I handle a server error in the middle of an Http message?
Assuming I already sent the header of the message and I am streaming the
the body of the message, what do I do when I encounter an...
5
How do I register a custom protocol with Windows so that when clicking a link in an email or on a web page my application is opened and the parameters from the URL are passed to it?
Vermiculation asked 17/9, 2008 at 6:57
3
Solved
I have a question about accessing file with Samba JCIFS.
So there is a server I want to access, let's call it server.unv.edu and the workgroup is WKGRP.
There is a share in this server: \\server.un...
2
Solved
Looks like weak references will be disallowed in protocols. So what am I supposed to do if I wanna add a weak reference? Any better idea?
protocol PipelineElementDelegate: class {
func someFunc()...
Handcuff asked 9/6, 2018 at 8:2
6
Let's say that certain items can appear in a Feed, so long as they implement the necessary properties defined by the Feedable protocol. Let's also say that the Photo object is feed-worthy:
extensi...
1 Next >
© 2022 - 2024 — McMap. All rights reserved.