« first day (3405 days earlier)      last day (1526 days later) » 

4:00 PM
@HéctorÁlvarez almost
@JonathonChase you do not want to see my recent visitors
 
Well now I think I do.
 
I generated some visitors for the program tree on my compiler
AST (which is per file) and PID (which is the entire program)
 
Oh, yeah, those should be pretty rough.
 
the base visitor is an interface with a lot of no-op template methods
one for each type of node in the code
 
I think the C# compiler team does something similar.
 
4:02 PM
many do
 
Atleast I recall reading an eric lippert article about code generated visitors being used.
What are you using to generate the visitors?
 
my own templates :D
 
ReadAllLines, Loop, Regex, Interpret, Done :D
 
I do wish to refactor them somehow but they do work now at least
they are generated by the same tool that generates the model classes
which is also the same tool that generates the (de)serializers for those models
all based on the model declaration
 
Have you used, oh what's it called... Jetbrains MPS?
 
4:05 PM
nope
the syntax is slightly based on protobuf, but kotlinized :D
message Person {
  required string name = 1;
  required int32 id = 2;
  optional string email = 3;
}
for example, this protobuf snippet would generate
- a model class/interface
- a builder
- a serializer
- a deserializer
- a visitor (one per module) that would contain a `visit/accept` function for this type
 
the syntax for the models for me is slightly different
I parse it using a tool similar to antlr... I also made that tool myself
 
antlr is another piece of tech i've been meaning to familiarize myself with
 
14 mins ago, by DK Dhilip
user image
this looks more like if Kyle Broflovski became a furry
 
South Park lol
 
4:09 PM
the code parser tool basically has all antlr features +
- left recursive (and right recursive) patterns,
- inheritance based lexer tokens,
- type based pattern matching,
- priority based pattern lists (with some options of handling recursion)
- and dynamic grammar (the ability to add rules/options to the grammar at runtime)
 
dynamic grammar seems like a good way to shoot yourself in the foot
 
it surely is
it is my approach of operator overloading
and any other form of alternative syntax
 
for example
 
If I overloaded, say, (+) on an integer type at runtime, would that change it's behavior for the entire lifecycle of the application?
 
4:12 PM
@AlternativeSyntax("@left '+' @right")
function plus(left: Integer, right: Integer) -> Integer
{ ... }
this is part of the base sdk
without it, 1 + 1 is invalid syntax
 
But I could choose time of execution? Like, say, when a particularly co-worker was the user account running the code?
 
the function is also annotated as @Native, which means the compiler must provide the implementation
 
Anything like goroutine?
 
@DKDhilip oh god that is terrifying
wtf is with his lips
 
@JonathonChase what?
 
4:14 PM
Can I conditionally override a piece of the grammar at runtime?
 
oh, dynamic grammar is only at runtime of the compiler
which is at compile time of your application
 
Well, that really limits my trolling potential.
 
it surely does
the only rules so far are that parens and braces "(){}" must remain balanced
this because the compiler first needs to analyze the structure of the code before it can parse the expressions
 
How about types? are you going for higher kinded polymorphism or are you sticking to first order generics?
 
4:16 PM
higher kinded polymorphism?
first order generics?
how about mixing some more terms
 
COALGEBRA
sorry
Yeah, are your generics going to be able to be generic?
 
I'm out
 
I still dont understand
from a C# perspective, what is higher kinded polymorphism? and first order generics?
 
First order generics are the regular generics we have in C#.
higher kinded polymorphism isn't supported in C#
 
then I will have first order generics
 
4:19 PM
but would allow you to define a base type for generic types that can be acted upon
 
sure
type Tree<Node extends TreeNode> { ... }
 
This is the C# language feature thread for HKP
 
same with
type Stuff<T super String> { ... }
 
type Tree<Node> where Node extends TreeNode, new() { ... }
 
@DKDhilip that's a mask? I thought it was a pillow o-o
 
4:23 PM
@JonathonChase I think that is just standard generics tho
 
Well, the higher-kinded stuff would be allowing you to declare types/functions that could act on both Tree and Stuff in a common way without the need to specify what their generic type parameters are.
 
@AlRey I also thought that at very first glance...
 
function <T extends ICollection<A>, A> Sequence<A>.to() -> T
{
	value ta = sorcery
	forEach { ta.add(it) }
	return(ta)
}
except for the sorcery
that is just forbidden
the problem is that the example in the language feature request is not safe
> T is constrained to be a generic type definition with one type parameter.
> var ta = new T<A>();
how about class Bork<T> : ICollection<String> ?
oh, lets just do this
myStuff.To<Bork<?>, Int32>()
aka var ta = new T<?>() (question mark doesnt matter
and (ta as ICollection<String>).Add(x as Int32)
now your code is bork
 
One thing before leaving for good
Reminder of old XKCD
 
but your compiler completely agreed with it being "absolutely safe to run"
because... well... it is strongly typed, right?
 
4:29 PM
Why the hell the thumbnail is expressed as AA/BB/CC!
 
that blog on the bottom looks like something I've seen in a hotbox pizza bathroom
 
It's not even clear which one's the day, or the month
that said, gtg
think about it
star it
discuss tomorrow, that's your homework
 
var obj = stackalloc Something<string32>();
I want that kind of magic
 
@JonathonChase the same problem with where T : new()
that is also forbidden
not all classes have a parameterless constructor
so, by principle, there will be a class that has no parameterless constructor, but you do want to use it as T
instead, a function reference (pointing to the constructor) should be passed, which would act as a factory method for the To function
 
well, new() is already a generic constraint for C#
 
4:34 PM
Link to the actual site to get the rollover text
 
@JonathonChase true, but it is stuff like that that makes me cry
 
There's probably a way to safely pass a type constructor though. Although I'm not sure what it is.
 
but where T : <> is only really needed for the new
at least in this example
so, either, it is a bad example, or it is a bad feature
on the bright side, I have Java level generics
so, you get a ton of more power anyway
 
Probably just a bad example. The feature aims to be able to allow you to generalize types like Functor or Monad
 
with stuff like ? super X or ? extends X
what implementation would you like for a function that accepts any Functor or Monad as input?
 
4:40 PM
I'd like to be able to let the compiler figure out generic type parameters without having to specify them explicitly.
 
public interface IFunctor<T>
{
    IFunctor<T> Filter(Func<T, Boolean> predicate);

    IFunctor<R> Map<R>(Func<T, R> mapper);
}
oh, how weird, IEnumerable could implement this interface
as would Task, Lazy, Optional, Result and many more
 
Okay, but now you want to write something that acts on arbitrary Functors.
 
and do... what?
 
Maybe I want to compose them
 
read their "Value" property?
remind me what compose does
there is no action you can safely do without having the function or property being declared in the IFunctor interface
so, either, you remove type safety, or you use the IFunctor interface
and my choice is to use the interface
on the other bright side, I have the implicit type :D
 
4:47 PM
I'm out of my depth here on this in any case.
 
function <T> unWrap(wrap: implicit) -> T
{
	return(wrap.value)
}
this function, at compile time, will generate a new interface
an anonymous one, with a property value of generic type T
it is applied to every class or interface that can possibly implement it
so, even if Lazy<T> does not implement any interface by default, it would now implement that new interface and be a valid argument for this function
and, you could even supply adapter implementations for the types you want the interface to apply to
but that is a last resort option
you need it because Lazy<T> is badly designed for not having an interface
 
Is it actually badly designed or just wietlol-badly-designed
I'm only half paying attention
 
probably both
I just dont understand the use case of higher kinded polymorphism
and no one is able to give me an example of where it is actually useful
to be more exact...
where it is
1, actually useful
2, not because of a bad design
3, impossible to solve in a better way (of which we know how to do it)
but I am off, laytar
 
Yeah I don't understand what it's for
Looks like interfaces but more hard
 
5:11 PM
okay I saw Harry leaving the room and I legit thought there was a bug walking across my screen when it did the animation
 
I have a List<Words> collection in a Paragraph type. I'd like to check if any of the word has ':' in it, if that index is > -1, I also want to check if there is any other word after that colon's index in paragraph.
The paragraph type also has a property 'Text' string which has all the words in it as one string.
 
What do you want to return?
 
I want to set a property of a paragraph enum, if ':' if the last character in the paragraph, enum.ContainsKeyAndColon else if there's any word\characters(except empty string) present, enum.ContainsKeyColonValue
 
V.7
 
para.WordsInParagraph.Any(s=>s.WordText.IndexOf(':') > -1 ?  Action to check if there's a word after : no keyValuePair)
Enumberable<T>.Any returns a single item. but instead is there a better way ?
para.IsKeyValueContentType = para.//Check the above conditions.
 
5:22 PM
What if there's a word that has a : between two words and a word that has a : at the end?
 
a word is set of characters without space in it. so word usually has : at the end all the time
in the same cell if there are more than one : and words before and after, i could stills set contains key value pair enum. Processing that will be next stage
 
Oh, so you're looking for a word that has a :, then want to know if there are any words after that one?
 
exactly !
I have two data to check this. 1.Paragraph.Text which is a string of whole paragraph text. and 2. List<Words> in Paragraph that could contain ':'
 
var words = new[] { "a", "b", "c:", "d" };
var otherWords = new[] { "a", "b", "c", "d" };

var hasWords = words.SkipWhile(w => !w.Contains(":")).Count() > 1;
var hasOtherWords = otherWords.SkipWhile(w => !w.Contains(":")).Count() > 1;
alternatively,
var hasWords = words.SkipWhile(w => !w.Contains(":")).Skip(1).Any();
var hasOtherWords = otherWords.SkipWhile(w => !w.Contains(":")).Skip(1).Any()
 
Thanks! did not know about skipwhile
 
5:34 PM
@Wietlol Oh! I remembered what the advantage was over your IFunctor<T> example. The return type would be the type that is implementing the Functor, and not IFunctor<T>. ie if IEnumerable<T> was implementing it, the result of Map<T,U> would be IEnumerable<U>, not IFunctor<U> while still maintaining the contract.
 
V.7
@markharringson Says localhost refused to connect.
Are you there?
Hello?!
 
6:22 PM
dude was last seen 9 hours ago
 
6:44 PM
@JonathonChase oh, that one is cute too
you should take a look at how Java's overriding method signature works
it is a much more powerful and comfortable approach
 
I'll look at it some time.
Been busy trying to shove haskell into my brain. So far it's not working.
 
for example using this type tree
interface A
interface B : A
interface C : B
class T1
{
	virtual B foo(B b)
	{ ... }
}
foo takes B and returns B
now, in C#, all subclasses that override foo must also do B -> B
in Java, the compiler is a bit smarter
class T2 : T1
{
	override C foo(A a)
	{ ... }
}
this class says "not only can I work with Bs, I can even work with As, so give me any A and I can work with it"
and "not only will I guarantee you receive a B, I can even guarantee you receive a C"
it provides more information on return types and asks for less information on parameters
in actual use cases, you could say IEnumerable.Map returns IEnumerable
 
Which function is called in this _pseudo_ code?
T1 foo = new T2();
foo.foo(someB);
 
but my List implementation guarantees that the return type is an IList
so, List<Integer> newList = myStrings.map { it.toInteger() }
it could even be a lazy list
applying the map when you access an item
@JonathonChase the overriding function
from T2
and it works because C is a subtype of B (which is allowed on return types)
and A is a supertype of B (which is allowed on parameters)
 
Do parameters have to be contravariant?
 
6:52 PM
but anyway, I gtg rn
 
alright, have a good one.
 
I guess ill be online in about 1.5 hours
 
 
1 hour later…
7:58 PM
Jack, tumbleweed
 

« first day (3405 days earlier)      last day (1526 days later) »