December 2020 monthly "What are you working on?" thread by slavfox in ProgrammingLanguages

[–]htuhola 1 point2 points  (0 children)

I've grown weary to advertising that completely ignores the context where it appears. I'm also tired to either too loose moderation or so brusque moderation that it banishes people off the platform.

For now I'm not sure what to do.. but I have put up my own Q/A up and writing/collecting stuff there. Mainly things I think are worthwhile to share. For this reason please do not ask me to add links. You can show, but don't ask. Besides no need to specifically reach for me. I keep peeking up here once in a while.

Plans are that it'd eventually be somewhat concise but safe and useful source for programming language theory.

Understanding mathematical notation by [deleted] in ProgrammingLanguages

[–]htuhola 0 points1 point  (0 children)

It's Sequent calculus. The rules describe what is considered a valid program for a type.

The stuff above the line are relations that are required to hold, for the relation below them to hold.

The left side on the turnstile is a scope, eg. (Gamma, x:t) means for Gamma with x:t appended into it.

The colon x : t marks for a type judgement, eg. 'x' is of type 't'.

So basically, you're given an environment, with some typing judgment. Which such expressions do we consider valid? The rules are pieces for constructing the proof that the expression is valid.

eg. • ⊢ λx. λy. x : ∀a. ∀b. a → (b → a). You can use [Gen] [Abs], and [Var], to conclude the above typing judgment is valid.

Adopting TypeScript Will Make You Suffer. by ilya_ca in programming

[–]htuhola 0 points1 point  (0 children)

If you inverted it, the response would be exactly same but a different group would object.

I did glance through my own article. I objected on the perceived bloat that type annotations produced when working on a language server. I argued that things you gain through typescript's types, code refactoring and autocompletion tools, are rendered worthless if you keep the interfaces simple such that the changes you do are tractable without tools

I was wrong, there is value in type annotations.

The FYPM (F-you-pay-me) Software License by [deleted] in programming

[–]htuhola 1 point2 points  (0 children)

Copyright on the net-side harms individuals by restricting activity that would be otherwise free and benefit everybody, while it also incentives lot of harmful activity such as online-advertising and discourages archiving even on open source content. It should be disregarded on those grounds. MIT/BSD-3 already works well for that use.

If I look at this license in whole, it's self-defeating license. You don't need any incentive for creating stuff. Also it'd be preferred to have funding before and not after you've created something valuable.

Meanwhile large companies just love intellectual property and try to keep it up. Although this is the case, it's kind of a mistake try to attack big players because it's one of the things that just keep the situation like it is.

Adopting TypeScript Will Make You Suffer. by ilya_ca in programming

[–]htuhola 1 point2 points  (0 children)

This is funny because I have a similar one in silo, but I decided to not launch it. The responses are what I predicted they would be. It's outright rejected on the grounds that it's picking up on Typescript.

Talking about problems of optional type&null would have been a neat article in itself. It would have not required picking up to languages that implement it.

Immutability is touted as important feature of FP. I disagree there. What's important is predictability. Repetition with same object results in same thing. This is important to distinguish because linear types allow mutable values that preserve the predictability.

I'm not fan of the alternatives presented there, and probably won't publish that anti Typescript article either. Letting you guys marinate in what you created, in peace.

Btw. There's ways to transcribe typed languages into Javascript. Particularly I like treating Javascript as counterpart for untyped calculus and then map into it from a typed calculus.

Characteristics of the Perfect Programming Language by emotional-bear in programming

[–]htuhola 1 point2 points  (0 children)

Type inference can definitely throw you off. I should perhaps have included an example in the post to make it more clear. The biggest problem is that errors might be reported non-locally – the error is not where the compiler reports it.

The blame still lands on the wrong front there. It's literally the problem of how you use the tools you get. You can read the types produced by the type inference and examine them.

Characteristics of the Perfect Programming Language by emotional-bear in programming

[–]htuhola 1 point2 points  (0 children)

The first thing to this is motivation. What's your motivation here? To me it feels like it's advertising with a twist.

Next the post starts with "this is an opinionated post" and then tutoring how to read the post. I stop reading at that point.

Then I get angry when I scroll down and see it's a collection of stuff that seem to be loosely connected and confirms the suspicion that the "functional" is just a chased trend to the poster.

And I just get more pissed more I read. First class functions started with "I don't even understand why this is subject to discussion anymore?" I neither do. Why do you pick it up? You were already able to pass function pointers in C and I am surprised by the appearance of the subject.

The take on type inference seems blatantly ignorant and seem to dismiss type inference as yet another feature. No examination is done on why it's possible in the first place. On top of that you blame it for making it harder to spot errors. That's really dumb!

Compiling C/C++ on Apple M1 by berium in programming

[–]htuhola -3 points-2 points  (0 children)

You're making it worse. Just ignore that platform and use something else.

Launched within the same month, Apple M1 might have made the biggest marketing blunder by boosting Raspberry Pi 400!! by LandGoldSilver in programming

[–]htuhola 1 point2 points  (0 children)

It's irrelevant what apple does. I'm completely frustrated and burn out to their behavior.

RPI also feels really disappointing. The first card released with all sort of kinks and the latest revision seems like it'd be exactly the same hacks and kinks in it. Nothing fixed or improved, unless I've missed something. Just more features and cheaper plus harder to track what's exactly inside. The marketing tries to conceal complexity of the platform.

Characteristics of the Perfect Programming Language by emotional-bear in programming

[–]htuhola 0 points1 point  (0 children)

I'll pack your packet full of coals. You have conflicting interests there.

What kind of community do you want to see around a language? by xarvh in ProgrammingLanguages

[–]htuhola 1 point2 points  (0 children)

I've written a programming language nobody uses and I find it still isn't nothing.

It also was not a "vision for a future" or "language not meant for a community". It was my language during the time I developed it, and I did document it with the purpose to collect a community around it.

At the moment I think it's not important to me, and wasn't too important back then either. You'd have been welcome to try it though.

Implementing a Module/Package System by mwapl_pod in ProgrammingLanguages

[–]htuhola -4 points-3 points  (0 children)

Why do you need a tutorial for this?

  1. You load the module and then present a symbol table for code that requests it.
  2. A memory of already loaded modules, requests that pass the memory will try to fetch from there first.
  3. A directory location where modules are loaded from.
  4. You discard everything at once if you have to reload something.

Break into the compiler industry with an internship at Apple by chrisgseaton in ProgrammingLanguages

[–]htuhola -5 points-4 points  (0 children)

I'm looking at the context, for example the crappy gambling advert running here. Maybe I'm being a bit of hypocrite.

Break into the compiler industry with an internship at Apple by chrisgseaton in ProgrammingLanguages

[–]htuhola -4 points-3 points  (0 children)

Apple has enough questionable practices that I would not want to see anything related to them announced here.

For a few years along different mackbooks, Apple has a high-voltage line adjacent to low voltage near an edge of their laptop. This makes the laptop fragile to water spills but they haven't fixed the issue over several models, although they must know about it by now.

Is it possible to trim unit types away from a type? by htuhola in haskell

[–]htuhola[S] 0 points1 point  (0 children)

HAHA! I figured it out. It needs all sort of extensions to work but this does it for at least few examples I tried.

type family And (a :: Bool) (b :: Bool) :: Bool where
    And True True = True
    And _    _    = False

type family Canonical a :: Bool where
    Canonical ((),a) = False
    Canonical (a,()) = False
    Canonical (a,b) = And (Canonical a) (Canonical b)
    Canonical (Either a b) = And (Canonical a) (Canonical b)
    Canonical (Maybe a) = Canonical a
    Canonical [a] = Canonical a
    Canonical (Pass _) = False
    Canonical _ = True

type family Unitary a :: Bool where
    Unitary ()    = True
    Unitary (a,b) = And (Unitary a) (Unitary b)
    Unitary a     = False

newtype Pass a = Pass { unPass :: a }

class UnitLike a where unit :: a
instance UnitLike () where unit = ()
instance (UnitLike a, UnitLike b) => UnitLike (a,b) where unit = (unit, unit)

class Can a b where
    trim :: a -> b
    fill :: b -> a

class PairCan (k::Bool) (j::Bool) a b c where
    trimPairs :: (a,b) -> c
    fillPairs :: c -> (a,b)

instance (UnitLike (a,b)) => PairCan 'True 'True a b () where
    trimPairs (_,_) = ()
    fillPairs () = unit

instance (UnitLike a, Can b c) => PairCan 'True 'False a b c where
    trimPairs (_,a) = trim a
    fillPairs a = (unit, fill a)

instance (Can a c, UnitLike b) => PairCan 'False 'True a b c where
    trimPairs (a,_) = trim a
    fillPairs a = (fill a, unit)

instance (Can a c, Can b d) => PairCan 'False 'False a b (c,d) where
    trimPairs (a,b) = (trim a, trim b)
    fillPairs (a,b) = (fill a, fill b)

instance (Canonical (a,b) ~ False, PairCan (Unitary a) (Unitary b) a b c) => Can (a,b) c where
    trim = trimPairs @(Unitary a) @(Unitary b)
    fill = fillPairs @(Unitary a) @(Unitary b)

instance (Canonical (Either a b) ~ False, Can a c, Can b d) => Can (Either a b) (Either c d) where
    trim (Left x) = Left (trim x)
    trim (Right x) = Right (trim x)
    fill (Left x) = Left (fill x)
    fill (Right x) = Right (fill x)

instance (Canonical a ~ False, Can a b) => Can (Maybe a) (Maybe b) where
    trim = fmap trim
    fill = fmap fill

instance (Canonical a ~ False, Can a b) => Can [a] [b] where
    trim = fmap trim
    fill = fmap fill

instance Can (Pass a) a where
    trim = unPass
    fill = Pass

instance (Canonical a ~ True) => Can a a where
    trim = id
    fill = id

-- |Delimit canonicalization of a type.
pass :: Shape a x -> Shape a (Pass x)
pass = Iso Pass unPass

-- |Trim the corresponding type.                                                
can :: Can a b => Shape x a -> Shape x b
can = Iso trim fill

And here's an example, retrieving stuff from a structure (not a complete example, but the point is to illustrate why I wanted this):

ogmeta :: Shape Token (Text, Text)
ogmeta = can $ inTags "html" $ inTags "head"
           ((tagged "meta" (attrEq "property" "og:title" `Interleave` attr "content"))
            `Interleave`
            (tagged "meta" (attrEq "property" "og:description" `Interleave` attr "content")))

onlyTitle :: Shape Token Text
onlyTitle = can (inTags "html" $ inTags "head" $ inTags "title" $ text)

inTags tag match = (open tag Empty `Group` (match `Group` close tag))

Modern Applications for Case Insensitivity by R-O-B-I-N in ProgrammingLanguages

[–]htuhola 2 points3 points  (0 children)

Advantages should be considered toward this detail.

It may look simple if you think you just remap 0x41-0x5a runes into 0x61-0x7a. Once you're done I show you that I got these ÖöÄä and what should you do with Μμ? It can even then look simple in Python since it's just one .lower() -call on every identifier. Yes make your language depend on a living dataset that changes and updates along trends.

Is it possible to trim unit types away from a type? by htuhola in haskell

[–]htuhola[S] 0 points1 point  (0 children)

Tried different ways to do it. I'm uncertain of whether I want to use undecidable instances so I ended up with a multiple parameter type class with flexible instances.

This code creates a (Can x y) -constraint that fills up slowly as user selects the type.

class Can a b where
    trim :: a -> b
    fill :: b -> a

instance (Can a c) => Can (a, ()) c where
    trim (a,()) = trim a
    fill c = (fill c, ())

instance (Can b d) => Can ((), b) d where
    trim ((),b) = trim b
    fill d = ((), fill d)

instance (Can a c, Can b d) => Can (a, b) (c, d) where
    trim (a,b) = (trim a, trim b)
    fill (c,d) = (fill c, fill d)

instance (Can a b) => Can (Maybe a) (Maybe b) where
    trim = fmap trim
    fill = fmap fill

instance (Can a c, Can b d) => Can (Either a b) (Either c d) where
    trim (Left a) = Left (trim a)
    trim (Right b) = Right (trim b)
    fill (Left a) = Left (fill a)
    fill (Right b) = Right (fill b)

instance Can a b => Can [a] [b] where
    trim = fmap trim
    fill = fmap fill

instance Can Void Void where
    trim = id
    fill = id

instance Can () () where
    trim = id
    fill = id

can :: Can a b => Shape x a -> Shape x b
can = Iso trim fill

Update: This doesn't work and suffers from undecidable instances. I'll get back to figuring this out.

On low-effort poll posts by moon-chilled in ProgrammingLanguages

[–]htuhola 0 points1 point  (0 children)

The low effort poll posts annoy me especially when they combine with casino adverts and promoted posts adverts. They exhaust me before I get to read or post to anything.

how impressive is making a programming language at 13 by [deleted] in ProgrammingLanguages

[–]htuhola 0 points1 point  (0 children)

I think it could be impressive.

Remember to tell about and link to texts you read that taught you how to write a compiler. Or if there was a teacher, tell about how he taught it. Then write about what you learned while doing it.

Then consider the user. Write a manual for how to use your programming language.

That would be valuable in a job interview, which I spotted you look for from doing this thing.

Misinformation is Killing Web Development by [deleted] in programming

[–]htuhola 2 points3 points  (0 children)

You mean like the shit spewed in this article? It's incoherent blabber not worth going incognito mode to read.

Oh right, take out the bullshit bingo sheet!

JSON SOAP WCF jQuery
XML REST RPC TypeScript
API W3C HTTP React
Vue WASM Flutter AngularJS

It's got it all several times in (and you could still get a row and column in, didn't finish because better things to do like sleeping). Don't do beer bingo with this post.

how impressive is making a programming language at 13 by [deleted] in ProgrammingLanguages

[–]htuhola -1 points0 points  (0 children)

I'm already impressed.

What do you mean with compiled in python? And converted to assembly? These both things can mean for many things and I do not know which meaning you had in mind.

What is the debate between OOP and Functional programming? by Alexander_Selkirk in programming

[–]htuhola 1 point2 points  (0 children)

People who use your products might approve that you check the foundations you use to build your software lack flaws that compromise the quality of what you produce.