Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Zlodo
Nov 25, 2006

sb hermit posted:

The best thing about templates in C++ in the late 90s is trying to decode compilation errors

The second best thing is trying to find out why template code in msvc wouldn't work in g++. I think it was because you need to explicitly generate template code by defining its use (with a specific type) in a cpp file. MSVC, since it knows the entirety of the source used in the executables (unless it's a library, I guess, but this was for student assignments anyway), could automatically infer which code to generate for which type and save you the hassle.

It's the same with msvc versus clang and it's kind of a pita if you work on a project with a mix of target platforms using msvc and platforms using clang. Everytime I do template stuff i fully expect the CI to scream at me about the clang platforms being broken.

One of the reason is that clang parses templates as soon as you declare them. If you write for instance a declaration whose type is T::butt, since the compiler doesn't know T while parsing the template, it doesn't know whether T::butt is a type or a member function or a variable or what, so parsing fails. You are supposed to write "typename T::butt" in this case, which is kind of ugly but is the only way to tell the compiler "T::butt is meant to resolve to a type".

Msvc however doesn't need this, because it defers parsing template when you actually use them, at which point it doesn't need that explicit hint to know what T::butt is.

Another thing is that for the same reason, anything you use inside of templates must be declared before the template itself in clang, and in msvc it's fine not to do so as long as it's defined before you instantiate the template.

Msvc basically tolerate code that isn't supposed to compile because of less rigorous handling of templates. It also have its downside, like you write a bunch of template code and it compiles fine and then you start actually using it and it turns out to be choke full of dumb mistakes

Zlodo fucked around with this message at 09:49 on Jul 18, 2022

Adbot
ADBOT LOVES YOU

animist
Aug 28, 2018

Sapozhnik posted:

Anybody who claims to be able to bash out syntactically correct code involving generics on the first attempt is a filthy liar

In any language with a concept of templates or generics or whatever.

in Rust i can do syntactically correct 😎

just not semantically correct

Powerful Two-Hander
Mar 10, 2004

Mods please change my name to "Tooter Skeleton" TIA.


Zlodo posted:

It's the same with msvc versus clang and it's kind of a pita if you work on a project with a mix of target platforms using msvc and platforms using clang. Everytime I do template stuff i fully expect the CI to scream at me about the clang platforms being broken.

One of the reason is that clang parses templates as soon as you declare them. If you write for instance a declaration whose type is T::butt, since the compiler doesn't know T while parsing the template, it doesn't know whether T::butt is a type or a member function or a variable or what, so parsing fails. You are supposed to write "typename T::butt" in this case, which is kind of ugly but is the only way to tell the compiler "T::butt is meant to resolve to a type".

Msvc however doesn't need this, because it defers parsing template when you actually use them, at which point it doesn't need that explicit hint to know what T::butt is.

Another thing is that for the same reason, anything you use inside of templates must be declared before the template itself in clang, and in msvc it's fine not to do so as long as it's defined before you instantiate the template.

Msvc basically tolerate code that isn't supposed to compile because of less rigorous handling of templates. It also have its downside, like you write a bunch of template code and it compiles fine and then you start actually using it and it turns out to be choke full of dumb mistakes

this is like the asp.net MVC view templating (aka razor templates) where they are explicitly strongly typed to a model but don't get compiled/processes until called so you can write something that looks valid then get a crash on calling it because of idk a null check or whatever. Not helped that visual studio is a bit erratic about whether it will or will not highlight errors.

at least view template changes can be made on the fly though

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

MrQueasy posted:

I don't think this is that hard in a language that does it well and simply, like Kotlin.

code:
suspend inline fun <reified RequestArg, reified Response> tryHttpBuildRequest(requestArg: RequestArg, noinline request: suspend (HttpClient, RequestArg) -> Response) =
    SuspendableResult.of<Response?, Exception> { httpBuildRequest(requestArg, request) }

gonadic io
Feb 16, 2011

>>=

MrQueasy posted:

I don't think this is that hard in a language that does it well and simply, like ... Haskell

type Lens s t a b = forall f. Functor f => (a -> f b) -> s -> f t

yes I know, I know, using kmett is cheating

Zlodo
Nov 25, 2006
I'm s t a b

Armitag3
Mar 15, 2020

Forget it Jake, it's cybertown.


Me? I'm Lord Rhaskell, and these are my esteemed cousins D. Functor and Mo 'Nads - we're here to collect on your gambling debts.

gonadic io
Feb 16, 2011

>>=
This is what happens when you can't pay off your technical debt

Xarn
Jun 26, 2015

Zlodo posted:

It's the same with msvc versus clang and it's kind of a pita if you work on a project with a mix of target platforms using msvc and platforms using clang. Everytime I do template stuff i fully expect the CI to scream at me about the clang platforms being broken.

One of the reason is that clang parses templates as soon as you declare them. If you write for instance a declaration whose type is T::butt, since the compiler doesn't know T while parsing the template, it doesn't know whether T::butt is a type or a member function or a variable or what, so parsing fails. You are supposed to write "typename T::butt" in this case, which is kind of ugly but is the only way to tell the compiler "T::butt is meant to resolve to a type".

Msvc however doesn't need this, because it defers parsing template when you actually use them, at which point it doesn't need that explicit hint to know what T::butt is.

Another thing is that for the same reason, anything you use inside of templates must be declared before the template itself in clang, and in msvc it's fine not to do so as long as it's defined before you instantiate the template.

Msvc basically tolerate code that isn't supposed to compile because of less rigorous handling of templates. It also have its downside, like you write a bunch of template code and it compiles fine and then you start actually using it and it turns out to be choke full of dumb mistakes

This is called 2 phase name lookup and MSVC finally started being standards compliant in 2017*


* Behind an experimental switch :v:

Powerful Two-Hander
Mar 10, 2004

Mods please change my name to "Tooter Skeleton" TIA.


gonadic io posted:

This is what happens when you can't pay off your technical debt

incorrect, you sell it as a collateralised technical debt obligation

animist
Aug 28, 2018

Powerful Two-Hander posted:

incorrect, you sell it as a collateralised technical debt obligation

aka a dependency injection framework

Captain Foo
May 11, 2004

we vibin'
we slidin'
we breathin'
we dyin'

Powerful Two-Hander posted:

collateralised technical debt obligation

Powerful Two-Hander
Mar 10, 2004

Mods please change my name to "Tooter Skeleton" TIA.



I cannot take credit for this, like all good posters I stole it
https://twitter.com/PHP_CEO/status/765298072691806209?t=wCMLGE3-YockKSQyOo_2Ng&s=19

I can take credit for popularising it at work though

redleader
Aug 18, 2005

Engage according to operational parameters

Zlodo posted:

One of the reason is that clang parses templates as soon as you declare them. If you write for instance a declaration whose type is T::butt, since the compiler doesn't know T while parsing the template, it doesn't know whether T::butt is a type or a member function or a variable or what, so parsing fails. You are supposed to write "typename T::butt" in this case, which is kind of ugly but is the only way to tell the compiler "T::butt is meant to resolve to a type".

Msvc however doesn't need this, because it defers parsing template when you actually use them, at which point it doesn't need that explicit hint to know what T::butt is.

this does seem like one of those things that should be standardized, but i guess the c++ committee were too busy fighting culture wars or something that day

Xarn
Jun 26, 2015
It is standardized. Shocking exactly noone, MSVC is not compliant.

The_Franz
Aug 8, 2003

Xarn posted:

It is standardized. Shocking exactly noone, MSVC is not compliant.

it's a lot better than it used to be and they now keep up with the standards vs the old days where they took something like 15 years to add c99 support and they didn't have full c++11 support until well after c++14 was out.

it still has it's weird quirks though, probably to deal with bad legacy code that would break if they actually fixed them and avoid the subsequent whining from windows-brained graybeards

sb hermit
Dec 13, 2016





I think I got one of the release copies of J++. I remember it being far better than any other Java IDE at the time.

To think that Microsoft could have made a ton of money off of Java tooling if the execs just played nice and not attempt the classic Microsoft extend and extinguish strategy.

mystes
May 31, 2006

sb hermit posted:

I think I got one of the release copies of J++. I remember it being far better than any other Java IDE at the time.

To think that Microsoft could have made a ton of money off of Java tooling if the execs just played nice and not attempt the classic Microsoft extend and extinguish strategy.
I think they realized that money from java tooling < money from keeping everyone on windows

There's probably a parallel universe where desktop java was successful enough that it didn't matter what os people used and windows lost

Shaggar
Apr 26, 2006
as a client application language java was worthless without j++. it was either let microsoft take over the language and provide extensions to make it useful on the one client OS that matters OR kick microsoft out of java and resign the language to server side only.

DELETE CASCADE
Oct 25, 2017

i haven't washed my penis since i jerked it to a phtotograph of george w. bush in 2003

Shaggar posted:

as a client application language java was worthless without j++. it was either let microsoft take over the language and provide extensions to make it useful on the one client OS that matters OR kick microsoft out of java and resign the language to server side only.

yeah well for client applications, we still didn't do that, just with javascript this time

Powerful Two-Hander
Mar 10, 2004

Mods please change my name to "Tooter Skeleton" TIA.


"Polyphemus what happened who has committed this code?"
"Nobody! Nobody has committed this code!"
*Sigh* "I'll mark this as blocked shall I?"

Sagacity
May 2, 2003
Hopefully my epitaph will be funnier than my custom title.

Shaggar posted:

as a client application language java was worthless without j++. it was either let microsoft take over the language and provide extensions to make it useful on the one client OS that matters OR kick microsoft out of java and resign the language to server side only.
it's really annoying to see that the only 'good' way of creating fairly lightweight crossplatform UIs is still Qt, after multiple decades. perhaps juce, if you're an audio developer, i guess. if you're not a c++ toucher you're pretty much out of luck. electron is a thing simply because other stuff was worse and that legitimately pisses me off somewhat.

meanwhile, the developer behind 'druid', one of a million half-finished UI crates for Rust, wonders why people aren't adopting it even though they've rewritten the core multiple times in a breaking way. (to be fair: he has a ton of really interesting ideas on UI toolkit development, it just never seems to go anywhere super concrete).

champagne posting
Apr 5, 2006

YOU ARE A BRAIN
IN A BUNKER

Sagacity posted:

it's really annoying to see that the only 'good' way of creating fairly lightweight crossplatform UIs is still Qt, after multiple decades. perhaps juce, if you're an audio developer, i guess. if you're not a c++ toucher you're pretty much out of luck. electron is a thing simply because other stuff was worse and that legitimately pisses me off somewhat.

meanwhile, the developer behind 'druid', one of a million half-finished UI crates for Rust, wonders why people aren't adopting it even though they've rewritten the core multiple times in a breaking way. (to be fair: he has a ton of really interesting ideas on UI toolkit development, it just never seems to go anywhere super concrete).

doesn't help that smartphones / tablets were thrown into the mix and took a big ol crap on how UIs are designed

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

Sagacity posted:

it's really annoying to see that the only 'good' way of creating fairly lightweight crossplatform UIs is still Qt, after multiple decades. perhaps juce, if you're an audio developer, i guess. if you're not a c++ toucher you're pretty much out of luck. electron is a thing simply because other stuff was worse and that legitimately pisses me off somewhat.

meanwhile, the developer behind 'druid', one of a million half-finished UI crates for Rust, wonders why people aren't adopting it even though they've rewritten the core multiple times in a breaking way. (to be fair: he has a ton of really interesting ideas on UI toolkit development, it just never seems to go anywhere super concrete).

avalonia looks like it has become really good over the past couple of years

jetbrains have been using it for some of their smaller products and those guys know a thing or two about programming

redleader
Aug 18, 2005

Engage according to operational parameters

champagne posting posted:

doesn't help that smartphones / tablets were thrown into the mix and took a big ol crap on how UIs are designed

actually phone uis are easy! just make everything really big and minimize the amount of things you put on the screen. anything that users might actually want to use should be hidden behind undiscoverable ui actions (double tap here! swipe there!). the beauty of this approach is that you can just reuse the ui without changes on desktops because they're basically the same as phones

Soricidus
Oct 21, 2010
freedom-hating statist shill

Sagacity posted:

it's really annoying to see that the only 'good' way of creating fairly lightweight crossplatform UIs is still Qt, after multiple decades. perhaps juce, if you're an audio developer, i guess. if you're not a c++ toucher you're pretty much out of luck. electron is a thing simply because other stuff was worse and that legitimately pisses me off somewhat.

the only thing wrong with desktop java these days is that people still remember desktop java 15 years ago

my homie dhall
Dec 9, 2010

honey, oh please, it's just a machine

Soricidus posted:

the only thing wrong with desktop java these days is that people still remember desktop java 15 years ago

also applies to non-desktop java

Shaggar
Apr 26, 2006

Sagacity posted:

it's really annoying to see that the only 'good' way of creating fairly lightweight crossplatform UIs is still Qt, after multiple decades. perhaps juce, if you're an audio developer, i guess. if you're not a c++ toucher you're pretty much out of luck. electron is a thing simply because other stuff was worse and that legitimately pisses me off somewhat.

meanwhile, the developer behind 'druid', one of a million half-finished UI crates for Rust, wonders why people aren't adopting it even though they've rewritten the core multiple times in a breaking way. (to be fair: he has a ton of really interesting ideas on UI toolkit development, it just never seems to go anywhere super concrete).

im hoping .net maui finally gives us something decent but im not holding my breath. also it would still require a brain to use which rules out all the web "developers" currently working on electron horseshit

pseudorandom name
May 6, 2007

redleader posted:

actually phone uis are easy! just make everything really big and minimize the amount of things you put on the screen. anything that users might actually want to use should be hidden behind undiscoverable ui actions (double tap here! swipe there!). the beauty of this approach is that you can just reuse the ui without changes on desktops because they're basically the same as phones

don’t forget to poorly reimplement they native platform UI widgets so all user interactions are jarring and unpleasant

Sapozhnik
Jan 2, 2005

Nap Ghost
GUIs are a very hard problem, we've had them for over 40 years and user expectations keep increasing every time we sort of have a handle on them.

It's not difficult to build a toolkit for something like a 320x240 original Apple Mac level of ui, but people expect rather more out of computers these days.

Electron sort of solves GUI development but in a very ham fisted way that leans too much on typography concepts for ui layout. But web engines do at least support things like accessibility, bidirectional text, and ideographic text entry, which is more than can be said for a lot of toy frameworks.

Sapozhnik fucked around with this message at 05:51 on Jul 21, 2022

chaosbreather
Dec 9, 2001

Wry and wise,
but also very sexual.

imo the biggest problem with these gui frameworks is they're all just 'here's how to build a form', not 'here's how to build a studio application'.

GenJoe
Sep 15, 2010


Rehabilitated?


That's just a bullshit word.
apple has you covered with the modern and slick gui framework, NSDocument

Sagacity
May 2, 2003
Hopefully my epitaph will be funnier than my custom title.

chaosbreather posted:

imo the biggest problem with these gui frameworks is they're all just 'here's how to build a form', not 'here's how to build a studio application'.
yes, pretty much this. something like a decent docking widget only exists in a handful of toolkits. the implementation in imgui is surprisingly nice, although it's imgui so you end up spending half of your time working around the various ways you have to pretend you don't have any state

chaosbreather
Dec 9, 2001

Wry and wise,
but also very sexual.

if one of the demos isn't a straight up rich text editor writing to a custom schema with embeddable custom widgets you can move around, and that code doesn't make you want to die, that ui framework is not ready. i've looked and man there isn't a single one that meets the textedit challenge, except web, which has like a dozen pretty good well maintained hugely popular libraries for doing that poo poo, and about 3 actually good ones.

Sagacity
May 2, 2003
Hopefully my epitaph will be funnier than my custom title.
yes, that makes sense. the 7 GUI challenges page is also a pretty good one. some libraries are actually trying to implement the challenges to prove they're usable in the real world.

mystes
May 31, 2006

chaosbreather posted:

if one of the demos isn't a straight up rich text editor writing to a custom schema with embeddable custom widgets you can move around, and that code doesn't make you want to die, that ui framework is not ready. i've looked and man there isn't a single one that meets the textedit challenge, except web, which has like a dozen pretty good well maintained hugely popular libraries for doing that poo poo, and about 3 actually good ones.
Yeah

Even poo poo like avalonia which is moderately mature by new ui framework standards doesn't even have a rich text editor at all and with frameworks that do it's impossible to customize

Most toy ui frameworks will never support accessibility/cjk input much less rich text editing so once you need that there's really no comparison.

This is an area where nothing comes close to the web and imo really prosemirror and its derivatives are pretty much unparalleled in terms of control of the schema (I think it's the only one that lets you prevent creation of additional paragraphs for example and it's dead easy to make your own widgets)

cool av
Mar 2, 2013

ugh please don’t try to put rich text editing in your apps just don’t you don’t need it

champagne posting
Apr 5, 2006

YOU ARE A BRAIN
IN A BUNKER

cool av posted:

ugh please don’t try to put rich text editing in your apps just don’t you don’t need it

laugh-cries-emoji in Microsoft Teams

hobbesmaster
Jan 28, 2008

chaosbreather posted:

if one of the demos isn't a straight up rich text editor writing to a custom schema with embeddable custom widgets you can move around, and that code doesn't make you want to die, that ui framework is not ready. i've looked and man there isn't a single one that meets the textedit challenge, except web, which has like a dozen pretty good well maintained hugely popular libraries for doing that poo poo, and about 3 actually good ones.

how does Qt not count?

Adbot
ADBOT LOVES YOU

outhole surfer
Mar 18, 2003

champagne posting posted:

laugh-cries-emoji in Microsoft Teams

at least modern emoji is still plaintext unicode. i'll take that any day over rich text.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply