[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Some hours hair pulling later, combination theory appliance to

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 8
Thread images: 3

File: sshot-4032.png (956KB, 1137x862px) Image search: [Google]
sshot-4032.png
956KB, 1137x862px
Some hours hair pulling later, combination theory appliance to code, not really sure how to solve in a great way.

Currently trying bit shifting to choose "or" parameters, but wondering if somebody has ideas?

IDL transformator in C#

Input:
void before(
(Node or DOMString) node,
(int or float) value,
(CssClass or DOMString) data)


Becomes:
before(Node, int, CssClass)
before(Node, int, DOMString)

before(Node, float, CssClass)
before(Node, float, DOMString)

before(DOMString, int, CssClass)
before(DOMString, int, DOMString)

before(DOMString, float, CssClass)
before(DOMString, float, DOMString)
>>
void before (Object node, Object value, Object data)


And later on use either some reflection magic or node.GetType(), value.GetType(), data.GetType() and react accordingly...
>>
>>56197882
Yes, i know this one, but everything 100% needs to be verified at compiletime, thats the feature. When generating all variants, only absolute known data can be passed in.

Its External-Call code, so i cant have code inside those functions.
>>
>>56197932
Wrap them into something like:

public class NodeClass
{
public Node NodeValue { get; set; }
public DOMString DOMStringValue { get; set; }
}


From here you should be able to simplify things a lot...
>>
File: sshot-4111.png (26KB, 692x535px) Image search: [Google]
sshot-4111.png
26KB, 692x535px
>>56198086
The thing is, Node or DOMString has nothing to do with eath other, independent function arguments.

Managed to find some solvable solution on the internet. Takes integer index and maps to parameter "or" variant

[0:0][1:1][2:-1][3:0]

parameter 0 -> or[0]
parameter 1 -> or[1]
parameter 2 -> Non-Or datatype, take normal
parameter 3 -> or[0]

Anyhow, seems like im done here :)
>>
>>56198170
They don't need to have anything together with each other. Abstract the shit that needs to get done, pass them as Actions into NodeClass for example, and Invoke them and let them do according to what is null...

But ok, you got it to work, have fun. Shitty language for a task like this tho, go with F# next time.
>>
File: sshot-4112.png (6KB, 280x199px) Image search: [Google]
sshot-4112.png
6KB, 280x199px
>>56198277
It just werks ;^)

But yes, "match" pattern-languages are better for this scenario, but kinda limited to use C# due the whole codebase is surrounded by it.

Altho, this thing is just a 1% part of the project with a specific purpose, kinda the last hard pussle part.

void before(
(Node or DOMString) node,
(int or float) value,
int normal,
(CssClass or DOMString) data)


There, a kind of binary counter, where _ is normal parameters.
>>
>>56198430
>but kinda limited to use C# due the whole codebase is surrounded by it

Just make a PCL and call the good F# bits from your project.

Anyway, cheers, fun thread!
Thread posts: 8
Thread images: 3


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.