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
Volguus
Mar 3, 2009

Hughlander posted:

For an extremely narrow set of problems that actually is really loving cool.

That No-op garbage collector is actually envisioned to be the skeleton upon which other collectors can be written. Yes, you're right that in a very specific set of circumstances it itself could be useful as is, but most of the time it'll be the base of other garbage collectors. That's the idea behind it, as I understand it.

Adbot
ADBOT LOVES YOU

senrath
Nov 4, 2009

Look Professor, a destruct switch!


Volguus posted:

That No-op garbage collector is actually envisioned to be the skeleton upon which other collectors can be written. Yes, you're right that in a very specific set of circumstances it itself could be useful as is, but most of the time it'll be the base of other garbage collectors. That's the idea behind it, as I understand it.

As far as I can tell from the link the no-op gc was designed to be used as is, not as a skeleton for further gcs to be written with. All of the things listed under "Motivations" are real (if niche) use cases, and none of them are "provide a framework for a functional GC to be built on."

Carbon dioxide
Oct 9, 2012

https://stackoverflow.com/a/39150189

Joda
Apr 24, 2010

When I'm off, I just like to really let go and have fun, y'know?

Fun Shoe

quote:

straightforward

:ohdear: How convoluted must the rest of the language be, if that constitutes as a straight-forward way to do a basic datetime operation.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.




Which one of you is this?

quote:

Thanks. This is disgusting. I love it. – wchargin

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
ISO 8601 is far from straightforward

Volguus
Mar 3, 2009

senrath posted:

As far as I can tell from the link the no-op gc was designed to be used as is, not as a skeleton for further gcs to be written with. All of the things listed under "Motivations" are real (if niche) use cases, and none of them are "provide a framework for a functional GC to be built on."

Here's where i've read about it: https://blog.idrsolutions.com/2018/04/java-10-improvements-to-garbage-collection-explained-in-5-minutes/

You're right that it is not a stated "motivation" of the GC, but it can obviously be used as such. Allocating memory is a (relatively) solved issue, not much to do there. De-allocating it is where the challenge lies.

Carbon dioxide
Oct 9, 2012

If you scroll up you can see this kind of trickery is no longer necessary since Python 3.7, but yeah, took 'em long enough.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
If Java was more suitable for writing CLI programs then the no-op GC would probably be a pretty commonly used thing. It's a really easy way to pick up a lot of performance when the OS is going to GC your whole program before it matters anyway.

JawnV6
Jul 4, 2004

So hot ...

Wasn't python's whole deal looking down smugly on perl for having more than one way to do something?

Soricidus
Oct 21, 2010
freedom-hating statist shill

JawnV6 posted:

Wasn't python's whole deal looking down smugly on perl for having more than one way to do something?

yes, and having everything you’d need built into the standard library

then they decided instead that they would build in thirty different ways to format strings, while recommending using third party libraries instead of the stdlib for important things because it’s easier to fix bugs if you can release things whenever instead of waiting for an update to the whole of python

so ... yeah, most of the early python philosophy has been dead for a long time

ToxicFrog
Apr 26, 2008


Plorkyeran posted:

If Java was more suitable for writing CLI programs then the no-op GC would probably be a pretty commonly used thing. It's a really easy way to pick up a lot of performance when the OS is going to GC your whole program before it matters anyway.

That's one of the motivations they mention, in fact!

Joda posted:

:ohdear: How convoluted must the rest of the language be, if that constitutes as a straight-forward way to do a basic datetime operation.

It's not so much convolution (in the language, anyways; anything involving dates and times is intrisically convoluted) as a hole in the builtin datetime library -- specifically, while it will happily generate ISO8601 dates, it can only parse a subset of them, since ISO8601, it turns out, offers some leeway in how formatting works. In particular, the time zone at the end can be any of:
code:
""
"Z"
"±HH"
"±HH:MM"
"±HHMM"
and strptime() only supports the first and last of those.

Making matters worse, the OP is asking specifically about RFC3339, a restricted subset of ISO8601 which only permits the middle three, i.e. exactly the ones Python's datetime parser doesn't support; and to add to the confusion, a number of the people replying have misread "RFC3339" as "ISO8601" and are answering the wrong question.

So at this point, the question basically reduces to "given that the language doesn't have a built in parser for this specific date format, what's your favourite 3rd-party date parsing library and/or favourite roll-your-own date parser" and that's pretty much always going to be a shitshow.

(FWIW, my answer would be "use a recent python that supports this format", and if that's not possible, "smoosh the RFC3339 date through a pair of regexes to turn it into an ISO8601 date strptime() can understand and then use that".)

Loezi
Dec 18, 2012

Never buy the cheap stuff
So Nike just bricked a bunch of shoes with a bad firmware update process.

https://twitter.com/Jaxbot/status/1097631614153175041

Rubellavator
Aug 16, 2007

Loezi posted:

So Nike just bricked a bunch of shoes with a bad firmware update process.

This sentence makes me feel old. Darn kids and their cyber shoes

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Carbon dioxide posted:

If you scroll up you can see this kind of trickery is no longer necessary since Python 3.7, but yeah, took 'em long enough.

Only for a subset of valid strings. AKA, strings generated with datetime.isoformat.

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

The secret to date time management is to do it one way and never ever change it. And if you're accepting input for it reject anything that even smells funny.

All that said I'm still reeling over the Solidity stuff.

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

It's get better, Solidity has actual defenders on /ethereum
https://www.reddit.com/r/ethereum/comments/72096k/is_solidity_a_great_language_what_does_the/

Mad Jaqk
Jun 2, 2013

Rubellavator posted:

This sentence makes me feel old. Darn kids and their cyber shoes

Calling them "cyber shoes" was enough to make me interested instead of angry at the entire concept.

QuarkJets
Sep 8, 2008

What motivates a person to desire cybershoes?

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.

Plorkyeran posted:

If Java was more suitable for writing CLI programs then the no-op GC would probably be a pretty commonly used thing. It's a really easy way to pick up a lot of performance when the OS is going to GC your whole program before it matters anyway.

Exactly. Disabling GC is also very common in HFT (high frequency trading) and has been for years. Pausing for GC is a dealbreaker there, so why bother if your trading app only has to run until the market closes? RAM is cheap, so just install enough to last the trading day.

xtal
Jan 9, 2011

by Fluffdaddy
I know that people turn the GC off with some PHP and Ruby programs as well. With Ruby on Rails some people disable GC during the duration of a web request.

Factor Mystic
Mar 20, 2006

Baby's First Post-Apocalyptic Fiction

QuarkJets posted:

What motivates a person to desire cybershoes?

only cybershoes look good when I'm wearing my cyberpants & cyberjacket

Dylan16807
May 12, 2010

ToxicFrog posted:

It's not so much convolution (in the language, anyways; anything involving dates and times is intrisically convoluted) as a hole in the builtin datetime library -- specifically, while it will happily generate ISO8601 dates, it can only parse a subset of them, since ISO8601, it turns out, offers some leeway in how formatting works. In particular, the time zone at the end can be any of:
code:
""
"Z"
"±HH"
"±HH:MM"
"±HHMM"
and strptime() only supports the first and last of those.

Making matters worse, the OP is asking specifically about RFC3339, a restricted subset of ISO8601 which only permits the middle three, i.e. exactly the ones Python's datetime parser doesn't support; and to add to the confusion, a number of the people replying have misread "RFC3339" as "ISO8601" and are answering the wrong question.

So at this point, the question basically reduces to "given that the language doesn't have a built in parser for this specific date format, what's your favourite 3rd-party date parsing library and/or favourite roll-your-own date parser" and that's pretty much always going to be a shitshow.

(FWIW, my answer would be "use a recent python that supports this format", and if that's not possible, "smoosh the RFC3339 date through a pair of regexes to turn it into an ISO8601 date strptime() can understand and then use that".)
Does any python version have a parser that supports "Z"? It seems like even with fromisoformat you need to throw in a .replace("Z", "+00:00")

Dylan16807 fucked around with this message at 02:52 on Feb 21, 2019

senrath
Nov 4, 2009

Look Professor, a destruct switch!


QuarkJets posted:

What motivates a person to desire cybershoes?

Theoretically they allow a better fit than traditional laces, but 99.99999% of the people who buy these things will never be in a position where that will actually be relevant.

RPATDO_LAMD
Mar 22, 2013

🐘🪠🍆

Bruegels Fuckbooks posted:

i do think a language with no garbage collector which also doesn't support manual memory management is complete genius and i wish all languages were like that. "gently caress it, nothing we can do about that memory leak."

Pretty sure Rust does this. You have to try pretty hard to slip a memory leak by the compiler's checks though.

Joda
Apr 24, 2010

When I'm off, I just like to really let go and have fun, y'know?

Fun Shoe
SQL code:
 
IF @Value > 1
    SET @Value = @Value

Found this gem at work. No elses or anything either.

redleader
Aug 18, 2005

Engage according to operational parameters

quote:

Of course we all might wish that the Solidity designers would have deeply studied preexisting formalisms for smart contracts

Why study pre-existing ideas about smart contacts for a language designed for smart contracts, when you can instead just slap some poo poo together and throw it at a blockchain?

Those defenders :psyduck:

Spatial
Nov 15, 2007

"The Unstoppable Will of Code"

Volguus
Mar 3, 2009

redleader posted:

Why study pre-existing ideas about smart contacts for a language designed for smart contracts, when you can instead just slap some poo poo together and throw it at a blockchain?

Those defenders :psyduck:

Well, those defenders are right that the creators of Ethereum needed something right then and there not 10 years later. It just neededn't be Solidity.

Nude
Nov 16, 2014

I have no idea what I'm doing.

QuarkJets posted:

What motivates a person to desire cybershoes?

From what I read the main pitch is you don't have to tie your shoes anymore...

You use an app instead.

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.

RPATDO_LAMD posted:

Pretty sure Rust does this. You have to try pretty hard to slip a memory leak by the compiler's checks though.

Releasing the object when it's no longer referenced/goes out of scope is like, memory management (rust's checks etc. ensure memory is handled like c++ smart pointers). Solidity has no mechanism for the programmer to reclaim memory that has been previously used.

iospace
Jan 19, 2038


Joda posted:

SQL code:
 
IF @Value > 1
    SET @Value = @Value
Found this gem at work. No elses or anything either.

Did you find who wrote that and ask them about it?

Joda
Apr 24, 2010

When I'm off, I just like to really let go and have fun, y'know?

Fun Shoe

iospace posted:

Did you find who wrote that and ask them about it?

No it's too old to ask about, based on context it was definitely meant to clamp the value.

Cuntpunch
Oct 3, 2003

A monkey in a long line of kings

Joda posted:

SQL code:
 
IF @Value > 1
    SET @Value = @Value
Found this gem at work. No elses or anything either.

code:
//C#
public class Foo
{
    private string _text;
   
    public Foo(string text)
    {
        if(text != null)
        {
            _text = text;
        }
    }
}
This 'pattern' was *rampant* at work and every time I asked the people doing it *why* they did it, they cited some sense of 'because we have always done it this way'. Some of the more junior folks, when asked *what* it does spent a lot of time and effort talking themselves in circles about how it was preventing null references.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



QuarkJets posted:

What motivates a person to desire cybershoes?

A miserable pile of disposable income.

redleader posted:

Why study pre-existing ideas about smart contacts for a language designed for smart contracts, when you can instead just slap some poo poo together and throw it at a blockchain?

Those defenders :psyduck:

IIRC their first try was a pure functional language but people found it too hard to understand and use lol

itskage
Aug 26, 2003


Cuntpunch posted:

code:
//C#
public class Foo
{
    private string _text;
   
    public Foo(string text)
    {
        if(text != null)
        {
            _text = text;
        }
    }
}
This 'pattern' was *rampant* at work and every time I asked the people doing it *why* they did it, they cited some sense of 'because we have always done it this way'. Some of the more junior folks, when asked *what* it does spent a lot of time and effort talking themselves in circles about how it was preventing null references.

https://docs.microsoft.com/en-us/dynamicsax-2012/developer/best-practices-for-accessor-methods


code:

container parmCode(container _code = conNull())

{

if (!prmIsDefault(_code))

{

code = _code;

}

return code;

}

e: phone posting so I'm not fixing that indentation.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

itskage posted:

https://docs.microsoft.com/en-us/dynamicsax-2012/developer/best-practices-for-accessor-methods


code:
container parmCode(container _code = conNull())

{

if (!prmIsDefault(_code))

{

code = _code;

}

return code;

}
e: phone posting so I'm not fixing that indentation.

I'd never heard of the product this relates to, though it is apparently a .NET framework language. Do you really think it's probable that Cuntpunch's coworkers got it from there? At the risk of generalising from my own experience, I assume that most C# programmers also haven't heard of this thing. It has fewer than 300 questions on Stack Overflow, which surely is hardly anything.

Athas
Aug 6, 2007

fuck that joker

Munkeymon posted:

IIRC their first try was a pure functional language but people found it too hard to understand and use lol

A pure functional language still with stupid type rules would not have made much of a difference. It doesn't look like the main problem with Solidity is how it handles effects.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Athas posted:

A pure functional language still with stupid type rules would not have made much of a difference. It doesn't look like the main problem with Solidity is how it handles effects.

Pure functional languages seem less prone to dumb as poo poo bugs than half-assed JS clones like Solidity, though. "If it compiles, it probably works" is something that gets said a lot about Haskell or Elm and that would be a good feature of an immutable codebase.

Adbot
ADBOT LOVES YOU

Athas
Aug 6, 2007

fuck that joker

Munkeymon posted:

Pure functional languages seem less prone to dumb as poo poo bugs than half-assed JS clones like Solidity, though. "If it compiles, it probably works" is something that gets said a lot about Haskell or Elm and that would be a good feature of an immutable codebase.

Really? I can come up with a ton of ideas for a pure functional language that I expect from the kind of mind that would create Solidity:

  • Dynamically typed, obviously.
  • All numbers are 512-bit integers.
  • Any value can be used as a function, which is string prefixing if it is string-like, or multiplication if it is number-like. So you can write 'x y'!
  • Implicit casting between strings and numbers, of course. Any string containing solely hexadecimal digits (ignoring whitespace) is interpreted as a hex number. Leading zeroes make it octal.
  • An expression using unbound names is implicitly considered a lambda taking parameters matching those unbound names. For example if 'x' and 'y' does not exist, the expression 'x+y' corresponds to Haskell's '\x y -> x + y'. The parameters are sorted alphabetically, so 'y+x' is also '\x y -> x + y'.
  • There is a record system, and any value can be extended with fields (Javascript-style) with the syntax 'object.fieldname = fieldvalue'. But it returns a copy of object, so purely functional, see?
  • If you try to read an unknown field, you get back numeric zero.
  • If you try to perform a mathematical operation on a function (e.g. 'f + 2'), then that creates an implicit lambda that applies the operation to the result of calling the function, i.e., this example becomes what you'd write in Haskell as '\x -> f x + 2'. This applies recursively if 'f x' returns a function, so be careful you don't blow the stack!
  • Speaking of the stack, the compiler does not perform tail-call optimisation, but recursion is still the only way to loop.

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