#Swift #enums are surprisingly flexible and powerful. I’ve re-written my navigation path to use an enum with associated values. It means:
* Multiple destinations for the same object (eg: a game view, edit game view, and game summary: all presenting a Game object).
* Simple state restoration via Codable conformance and scene storage.
Harness the power of #Enums in Laravel with PHP 8.1's native enumerations. #Laravel v8.69 supports this, enhancing code cleanliness and efficiency. For a Post model with a 'status' attribute, define an Enum class, PostStatus, instead of using strings like 'draft', 'in_review', 'published'... Laravel's $casts property in the model converts these status values to Enums. Laravel also provides an Enum rule for form request validation. Embrace Enums for excellence and performance in Laravel projects.
@hazz223 related warm recommendation… the video about the downsides of #enums in #Typescript and how to deal with it
C programmers, please help me figure out something:
Since C23, a C enum may be declared to have a specific underlying type, as in the following example. My question is, how can I find the underlying type of such an enum? (C++11's std::underlying_type trait gets me this information.) 🙏
```C
enum Size : char { small, medium, large );
```
Code example in C++ and C: https://sigcpp.godbolt.org/z/eo7Tdqaeb
C enum: https://en.cppreference.com/w/c/language/enum
#question #c #programming #cpp #cplusplus #enumerations #enums
#question #c #programming #cpp #cplusplus #enumerations #enums
You can't extend #PHP #enums, but you can have them implement an interface:
```PHP
<?php
interface TypeEnumInterface {}
enum AType: string implements TypeEnumInterface
{
case A = 'A';
case B = 'B';
}
enum BType: string implements TypeEnumInterface
{
case A = '1';
case B = '2';
}
function tester(TypeEnumInterface $x) {
if ($x instanceof AType) {
echo 'Was AType: ' . $x->value;
}
if ($x instanceof BType) {
echo 'Was BType: ' . $x->value;
}
}
tester(BType::A);
```
I created a #video demonstrating the code examples from an earlier #blog post: "Hidden Beauties of #Java #Enums".
Video: https://youtube.com/watch?v=U09ZQ3kjuqM
Blog post: https://webtechie.be/post/2023-03-22-hidden-beauties-of-java-enums/
Behind the scenes: still some work to do on my green screen as I'm not really happy with the final keying result. And you may hear some snoring in the background. That's our dog Wifi who was sleeping, really behind the scenes, as you can see in the picture ;-)
This is a really cool trick for #enums in #php .
https://laravel-news.com/extending-php-enums-with-attributes
Published a new #blog: "Let’s take a look at the power and beauty of what #Java #Enums can provide…" in which I explain how I use enums in various projects, even as some kind of "database" with the various @RaspberryPi boards.
https://webtechie.be/post/2023-03-22-hidden-beauties-of-java-enums/
#rust - #structs and #enums are the basis of what I'm trying to do I think, so....good direction! Unlike #ownership, this part actually makes sense for me.
#rust #structs #enums #ownership
#Shaarli: Best practice of using PHP Enums! https://links.shikiryu.com/shaare/3S7dsg #PHP8 #enums
Creating a pronoun enumerator with matching word functions for my app.
You'd think there was a php library for it somewhere to save me a bit of time, but I haven't been able to find anything so far. :/
In other news: ***annoyed rabbit noises***
#php #enums #laravel #nerd #programming #furry #yourentireITdepartmentarefurries
#yourentireITdepartmentarefurries #furry #programming #nerd #laravel #enums #php
Oh, wir haben es hier wohl mit einer impliziten Annahme über das Format eines Strings zu tun. Kann man nix machen. Muss man fixen. #enums #toldyouso