« first day (3251 days earlier)      last day (1696 days later) » 

mr5
3:00 PM
@Wietlol reflection? modify the internal collection it uses?
 
its not some random collection it uses
its the code flow that needs adjusting
 
This room is so incredibly active. Why did the JavaScript room implode? Just curious. Nice to see a vibrant room :)
 
ProjectTo seems to be a special function only for IQueryable
 
mr5
@Wietlol why did it have a special name?
 
Oh, I was wrong again then
 
3:03 PM
@mr5 what do you mean?
 
mr5
@JoJo are you a JoJo reference yourself?
@Wietlol usually, it's setter and getter. Why did you call it "monad"?
 
@JonathonChase collections are also a special case :(
@mr5 monad is not invented by me
its a common word
and its not setter and getter
 
@Wietlol Well, given the limitations we have on monads in C# I would expect you would need to write an adhoc special case for any monads you implement
 
I was afraid of that
 
since we can't generalize over generalizations I think that's just the way of it.
we can stare longingly at the higher kinded polymorphism proposal, though.
 
mr5
3:07 PM
@Wietlol where else I could use the word monad aside from mappers?
 
@mr5 JoJo reference?
 
mr5
I wish we can have a compile-time DI just like Java's dagger2
 
@mr5 mappers are something monads have
a monad is a wrapper
for example, Nullable is a monad
the value is inside that nullable
the map function maps the data inside the monad
 
mr5
can I say, monad is something the simplifies a thing?
 
for example, Nullable(42).map(Int32.ToString) is Nullable<String>
 
mr5
3:09 PM
@JoJo it's a meme
 
common monads are Nullable/Optional/Maybe, Collection/Iterable/Enumerable, Result, Task, etc
for something to be a monad, it must have a few operations:
- filter (where in C#)
- map (select in C#)
- flatMap (selectMany in C#)
if the flatMap makes no sense or is impossible to implement, it isnt a monad but a functor
 
or if the dev is feeling lazy that day and a functor is enough
 
mr5
I still don't understand :(
 
or that
 
I don't think filter is required for functors either
 
just that map preserves identity and morphisms
 
hmm...
I may have been too enthousiastic with filter
 
mr5
hmm I guess I need a little bit of knowledge of functional programming before I going ahead
 
we spilled functional programming all over our C#
 
monads are very useful and existed really long in non-functional languages
not older than functional languages tho... some functional languages are ancient
 
user10864482
3:15 PM
cough powerhouse
 
just use f# ;p
 
ew
I will use Wietlang
 
yeah i know
 
user10864482
visual foxpro
 
i think ill use FORTRAN but thanks
 
3:16 PM
@mr5 you shift this late?
 
mr5
@c0dem0nkey no man. I'm home already haha. I just want to chit chat a bit before sleeping
how about you?
 
@mr5 same. chitchat and a couple of drinks
@mr5 not to mention learning xamarin on the side
 
mr5
@humanpony I remember that thing but I didn't use it. Somehow, it got installed in my laptop way back 2012
@c0dem0nkey nice. XF right now is going nuts. implementing features aren't needed for the moment while a lot of people are demanding for stability
 
user10864482
@mr5 back then I worked in IT and there was this client who had a custom solution built on that language. The only good souvenir I have from that time is how easy it was to decompile those dll into their original code component .
 
mr5
@Wietlol I remember functor in C++ as assignable function, or in C# context, an Action<T> or Func<...>
 
3:21 PM
hmm Newtonsoft json deserializer calls default constructor, but .NET xml deserializers don't
 
mr5
@humanpony I'm sure it looks like vb6.0
 
user10864482
@mr5 yes
 
user10864482
'The ron burgundy podcast' on spotify is really something
 
should I have a burger with fries or a salad for lunch?
 
mr5
@Wietlol I kinda implement the same thing from our project. I called it DataResponse<T> which wraps every http response so we could just check one property if it succeeds, another property for getting the data, property for checking the error type, and an optional property rarely used for getting the friendly error message
@erotavlas ice cream
 
3:25 PM
maybe if I had a sweet tooth
 
mr5
and then extension comes along to act like a map to support a more complex type and a helper to map to another type
 
I have low tolerance for sweets, one bite of cake and I'm done
 
mr5
I pity you. ice cream is one of my fav food of all time
 
@mr5 there you go, you have yourself a functor
as I said, its not rare, just the term that people are unfamiliar with
 
user10864482
@erotavlas I discovered ginger cookie; not to sweet but so tasty
 
3:28 PM
the same we have with our message queue system, event system, logging system, etc
 
mr5
So I think my first impression about monads is correct:
19 mins ago, by mr5
can I say, monad is something the simplifies a thing?
 
ginger snaps?
 
not really simplifies
just wraps
 
user10864482
and xylitol its a beauty. An educolorant coming from wood
 
mr5
eh, it prevents boilerplate code
 
3:29 PM
true
 
mr5
@humanpony "xylitol" something wietlol would name his daugher
 
that would make a good name
 
user10864482
@mr5 I got some made of birch. It's actually better than stevia as it doesn't have a wierd after taste
 
@mr5 pfft
my doughter would be named Wietsmoll
 
I'm going though an anti sugar phase, apparently its toxic
 
mr5
3:31 PM
wietlmao
wietkek
@Squirrelintraining
 
Wietroflcopter
 
eating a cookie is akin to smoking a cigarette
 
drinking a cookie is the result of being too drunk
 
mr5
@humanpony you know a lot of jargons. Which particular field did you came from?
 
lumberjack
 
3:32 PM
wheat field
 
I HATE OUR SHITTY SERVERS
 
I hate your shitty servers too
 
user10864482
@mr5 nothing related to wood :) I was in IT for a number of years, now I'm working for a gov
 
mr5
that's what you get for having your server near your workstation :)
@humanpony tell me, how is the corruption going there?
 
@CaptainObvious you don't happen to work for a dictionary company do you?
 
3:35 PM
No why
 
ohh no reason
 
user10864482
@mr5 there have been a number of related issue over the years but from what I heard we are good when compared to other countries. I'm working for Canada gov
 
Oof no onebox for the stack blog
 
mr5
3:36 PM
@humanpony oh nice. have you heard about the recent issue between your country and ours (PH)?
 
user10864482
@mr5 Philippines ?
 
mr5
yeah
 
the garbage?
 
mr5
yas! haha
 
user10864482
I would like to emphases that any view I express are my own and that I do not represent my employer.
 
3:39 PM
that's not really recent in terms of world news. but it was shitty of us.
 
mr5
@humanpony gov have already started their cron job to lurk all over the internet with your name with it
 
I think both governments were a bit pratty about it tho
 
user10864482
we do have a recycling material problem since china revised what they consider good material
 
user10864482
@mr5 I can assure you I know it's a thing
 
mr5
I kinda what to bring up how Singapore manages to recycle their stuffs there. I think Canada can roll their own too
 
user10864482
3:41 PM
I don't even have any social media what so ever because of that
 
mr5
both parties are at fault since we also had a stupid admin by that time
@humanpony because of working in government?
 
When I'm on a breakpoint in VS, is it possible to do a deep nested search of an object for a particular value?
 
mr5
why do we get this feeling of, when you start to work for someone bigtime, you start to limit to express yourself in social media?
 
That's only if you use your real name in social media
 
mr5
true. even being completely anonymous, you can't still fully express yourself
 
user10864482
3:48 PM
@mr5 yes. It might be different for everyone but I actually signed paper to become public neutral
 
mr5
@Hypersapien try the immediate window. afaik, it's possible
 
user10864482
@mr5 signing legal paper helps to think that way
 
mr5
I'm not even sure if those are written in my contract but I have the feeling of limited expression
 
@mr5 Problem is that it's an object with a bunch of List<> members
 
user10864482
@mr5 for me it was a different set of paper, its called an oath
 
3:54 PM
Guys, I need your C# experience... Recently, I used c#7's deconstructors to grab some values from a class. This is the first time deconstructors are used in a project where I work. Today, I had a day off, and a senior developer reverted the change, claiming it's "unreadable" and innefficient because other devs would have to read up on deconstructors to understand the code:
How do I convince him he's an <redacted> and should go with the times?
Ugh, of course dinner is ready now... I'll bbl -.-
 
@Cerbrus Do they use DI, IoC, Func<T,Tresult> and other new language and framework features ? It's hard but you gotta do what is right
 
My initial feelings would be you should probably follow whatever coding standards your company already has in place
 
user10864482
@JosephMawer I have to agree on that
 
They have ni standards for C# 7 features
And that guy is kinda “it’s new, I don’t know it, we’re not gonna use it”...
(Small team, by the way)
 
4:10 PM
Huh, I somehow completely missed object deconstructors as a feature.
 
its nice... but you cant use it in the #1 place where you should
 
I don't know if that's the particular feature hill I'd pick to die on
 
mr5
@Cerbrus is User.GetClaims a dictionary?
I'd rather to "map" it to another type rather than manually extracting values by key
 
@Wietlol Is that one place as part of a lambda expression?
 
yep
 
4:13 PM
That would be so nice now that I think about it.
 
it would indeed
 
I'm guessing it won't infer the types.
 
map
    .entries
    .filter { (key) -> key.contains("hello") }
    .forEach { (_, value) -> println(value) }
 
@mr5: they’re methods
Note: that block in the screenshot was duplicated 4-5 times throughout the application
 
mr5
4:17 PM
or how about, create an extension where it returns a single type
I kinda agree that deconstruction is weird to use in that case
var memberDto = User.ToMemberDto();
 
If I were going to pick a feature hill to die on, it would probably be inline declaration of out parameters.
 
mr5
(_1, _2, _3, _4, key) => GetSometing()
 
@mr5 That GetSomething function is basically the same as the deconstructor then
 
mr5
sorry, it was destructuring
 
Oh, we also use that deconstructor to grab separate variables, not only class->class
 
mr5
4:30 PM
yes. it's basically the same thing
 
Hrm, There doesn't happen to be a massive convenient performance gain when using a deconstructor, right? :D
 
mr5
it's just a syntactic sugar
 
I figured as much :P
 
afterrnoon
 
Good evening :) I'm just getting back into C# from the F# world. Semantically, are C#'s delegates equivalent to F#'s functions?
Both are typed by means of typing the input and output
 
user10864482
4:46 PM
@SamuelWakeman hey
 
@RonaldMunodawafa I think so. Delegates are just pointers to functions. Anonymous functions might be closer to what you are thinking of.
 
yes the delegates are bound by type
 
Don't know enough about F# to give a great answer here.
 
3
Q: Convert C# delegate to f#

user12cdhbw7how do I convert delegate to F#? the delegate: delegate IntPtr HookProc(int code, IntPtr wParam, IntPtr lParam); Edited What I'm doing is to do Low Level Keyboard Hook using managed API from c# in F# Code: [<DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)>] extern bool...

 
Thank you guys
And it's good to be back
 
4:47 PM
Converting one to the other - might give you more insight
Feels good
 
Next question: Are they 100% interchangeable
I have to research this on my own
 
6
Q: Using c# delegates with f# functions

b1g3ar5I am trying to call a c# function from f# where the c# function takes a function (delegate?) as a parameter and I need this argument to be a f# function. Eg: Sample c# public static void function_1(double x, ref double y) { y = Math.Exp(x); } main() { state s; call_func(s, functio...

This suggests they are slightly different.
However, an Action may be the same.
Action and Func
 
Reading the F# source might help as well
 
Actually, come to think of it, maybe you should just look at Func.
https://docs.microsoft.com/en-us/dotnet/api/system.func-2?view=netframework-4.8
Func's are variables you can pass around to methods and store if necessary.
 
I think you might have issues with F# methods that return () if you rely only on Func
 
4:53 PM
Yep
I am not sure if C# has a unit type
Or a type for void essentially
 
Nope, big bummer. Gotta use Action for void delegates
 
Delegates are just pointers to functions. Meaning that if you call a method on a class you have to worry about the class existing.
@JonathonChase Yeah, that's why I mentioned Action.
 
Action<T> would be equivalent to () => T right?
 
@RonaldMunodawafa Yes.
 
other way arround?
Func<T> would be () => T
 
4:55 PM
@JonathonChase Shit, my bad
 
Action<T> would be T => ()
 
Let me type out some examples
 
Thank you
 
delegates also support addition, so they aren't quite just function pointers
 
They support
 
4:56 PM
Action<T> = T => ()
Func<T> = () => T
Func<T1, T2> = (T1) => T2
 
I see
What if you want () => ()
 
The last type parameter is always the return type.
 
Action
eg Action x = () => {};
 
Thanks so much guys
 
Look at the Linq Enumerable extensions. They use Expression<Func<T1, T2>> and the like.
 
4:59 PM
@humanpony have you ever used fiddler?
 
You can ignore the Expression and just read it as Func<T1, T2>
 
user10864482
@SamuelWakeman yes
 
how are hard is it to learn?
 
Queryable using Expression<Func<Etc, I think IEnumerable just uses Func
 
user10864482
@SamuelWakeman not hard. have you heard of zed?
 
user10864482
5:00 PM
I would say wireshark is harder
 
So you can do things like:
myList.Select(x => x.Property)
 
the league of legends champion or the greek letter? yes else? no
 
user10864482
 
user10864482
the purpose is ultimately different than fiddler but the means is the same
 
By the way, Visual Studio has improved in performance
 
5:02 PM
@JonathonChase You are correct. So yeah definitely look at the IEnumerable extensions.
 
I always used to bash them all the time
There would be less to remember if C# had typed void only had Func
 
user10864482
I discovered it a couple of years ago at a bside security conference. The stuff one can achieve with that is amazing. I used it actively on hackerone target. It's pretty neat
 
For where you would use a predicate I'm sure a function from F# returning a boolean would still work
 
@RonaldMunodawafa var description = myList.Where(x => x.Id == 1).Select(x => x.Description).First();
The where would return bool.
Could be done easier this way as well: var description = myList.Single(x => x.Id == 1).Description;
 
Are Func<T, bool> and Predicate<T> functionally equivalent then?
 
user10864482
5:06 PM
owasp at large is a very interesting project too
 
@RonaldMunodawafa Functionally, yes. C# libraries prefer to use Func<T, bool> though.
Doesn't appear to be an easy way to convert from a predicate to a Func without creating a wrapper however.
Predicate<bool> a = b => b;
Func<bool, bool> c = d => a(d);
 
Is there any reasoning given?
 
Predicate is old. Second post explains why the change was made.
https://stackoverflow.com/questions/665494/why-funct-bool-instead-of-predicatet
As for why they don't convert, no idea. Probably difficult to achieve in the compiler or something.
 
The second answer answers my first question
Delegates and F# cannot be considered compatible with each other
Assuming they are would only lead me down a road of misery
@TylerStahlhuth I think it's an application of the Open/Closed principle. They extend the language but never modify previous versions
That way they maintain backwards compatibility and also bring new features to the language
I don't think it's something to do with difficulty in implementation
Delegates as I see them seem to be an extension of C#'s type system
 
@RonaldMunodawafa Yeah, that's why I was pushing towards Func and Action. Those are probably similar if not the same. Delegates are just pointers. Using delegates to a method in a specific class won't work the same way as a Func or Action since those store information about the method that creates them.
 
5:18 PM
Func and Action are delegates, i'm not sure what you mean
 
They are just specialised delegates
 
Here's the declaration from reference source: public delegate TResult Func<out TResult>();
there are obviously another 15 declarations for the different amounts of paramters
with 16 being the line in the sand MS drew, I believe
 
They could have avoided that had they gone the route of supporting currying and partial application
But I assume there are practicalities involved with introducing certain conceptions into a language targeting a specific market
 
partial application is tricky because the return type of a method isn't considered when doing overload resolution
 
@JonathonChase I could have sworn there is a bigger difference than that.
 
5:23 PM
@TylerStahlhuth How come?
 
If you find some docs to support that I'd love to see em
 
user10864482
yes.. Microsoft finally removed the limit on tuple. docs.microsoft.com/en-us/dotnet/api/… Now my imagination and lack of readability is my limit
 
Start using tuples of tuples to make your code look like a lisp
 
user10864482
tuple and anonymous function. I love them
 
user10864482
it's actually faster to write proof of concept
 
user10864482
5:26 PM
@JonathonChase tuple of tuple in a list. Way to go, stranger
 
user10864482
:)
 
@JonathonChase Doesn't appear to support ref.
22
Q: Delegates vs Action, Func in C#

anfriThis might seem a silly question, but it's just for curiosity's sake. We have two particular already-defined delegates in C#: Action<T> Func<T, TResult> Action encapsulates any "void" method that takes 0 or more parameters. Func encapsulates any method that returns a specific value type and ...

I remember having issues with delegates in the past that were solved by simply using the Func and Action classes.
I just can't remember what the problem was.
 
void Main()
{
	Func<string, string> x = Foo;
	var s = "";
	var res = x(ref s);
	Console.WriteLine(s + res);
}

public delegate T2 Func<T1, out T2>(ref T1 t1);
public string Foo(ref string x) { x = "hello, "; return "world"; }
So that limitation is basically just that they didn't implement delegates for that.
Also, because implementing that delegate seems to shadow the original Func<T,TR>, so that's an issue.
 
@JonathonChase Do you have to mention out T2 in Func<T1,out T2> ? though by default T2 is an out ?
will it compile if theres no 'out' specified?
 
It's the generic out, not the param out
just marks it as contravariant
 
5:37 PM
ah
 
or covariant.. i flip those in my head often
but yes you can omit it.
 
yeah reading them to refresh the brain
it is covariant in this case
 
it's covariant. in is contravariant.
 
yeah
 
5:54 PM
:47268370 Covariance

Enables you to use a more derived type than originally specified.

You can assign an instance of IEnumerable<Derived> (IEnumerable(Of Derived) in Visual Basic) to a variable of type IEnumerable<Base>.

Contravariance

Enables you to use a more generic (less derived) type than originally specified.

You can assign an instance of Action<Base> (Action(Of Base) in Visual Basic) to a variable of type Action<Derived>.

Invariance

Means that you can use only the type originally specified; so an invariant generic type parameter is neither covariant nor contravariant.
 
6:08 PM
@JonathonChase Maybe I was wrong. I'm trying to remember the problem I was having and can't figure it out.
I thought it was something weird with using static classes or methods in some way.
 
6:47 PM
@RonaldMunodawafa hey bud long time no see
 

« first day (3251 days earlier)      last day (1696 days later) »