logs archiveBotHelp.net / Freenode / #ada / 2015 / July / 17 / 10
jk4
no
you can have access-to-procedure objects however
oliver117
access to subprograms though
:D
hi
jk4
hi
though i don't know that i've ever seen anyone use them in a way that wasn't trying to force other language idioms on Ada
well, that's a lie, but not far off
lamadasdas
so the record here allows me to define parameter of Chat_Server?
jk4
it's the storage for Chat_Server
for an individual Chat_Server object
A : Chat_Server;
lamadasdas
i would like to have there a container of all clients, its numbers and sockets
this kind of things can be stored in record, correct?
jk4
cool so put it in there
sure
lamadasdas
ok, cool
now
:D
i would like to Chat_Server have some procedures/methods that can be called
like Chat_Server.Start
you get the idea
what is the ADA aproach on that?
jk4
okay. we have primitive operations
oliver117
you define the subprograms in the same package together with the record
lamadasdas
if record cannot contain procedures or things like that
jk4
that are done thusly^
Natacha: sorry i believe they're called the Gang Of Four
lamadasdas
ah
jk4
sounds more criminal that way
lamadasdas
another thing - i would need to create some sort of package for Chat_Server, right?
jk4
charlie5's way of naming might be insightful fo ryou
lamadasdas
and in this package there will be this record
is that correct?
jk4
package Chat_Server is
Natacha
"The Gang of Four was a political faction composed of four Chinese Communist Party officiels." says wikipedia
lamadasdas
right
and then this package, and record, and everything in it can be access via that dot ".", right?
jk4
package Chat_Server is type Item is record ... end record; function Create return Item; procedure Start (Server : Item); end Chat_Server;
lamadasdas: you'd have to tag the record to use dot notation. it is a controversial topic
would suggest not tagging the record just for notation
Shark8
"Gang of Four" can also refer to the authors of this: https://en.wikipedia.org/wiki/Design_Patterns
jk4
so to use the pckage as I build it for oyu there
A : Chat_Server.Item;
begin
Chat.Server.Start (A);
lamadasdas
ah, ok since i'm total noob and learning, i don't want anyting non-standard or like that :D
:)
jk4
ahem
Chat_Server.Start (A);
still have the notation, but rather than Chat_server being the type, it's Item within Chat_Server
is generally much cleaner looking than languages that lump everything into classes
s/classes/the same thing/
lamadasdas
The tagged record is one part of what in other languages is called a class. It is the basic foundation of object orientated programming in Ada.
so this is considered a bad thing?
Visaoni
No, not bad at all. You just don't always need it (if we're talking about tagged types)
lamadasdas
so why it is controversal?
Visaoni
the dot notation is the controversial bit
lamadasdas
is it something like using unsafe in regular programing in c#?
Visaoni
no no not at all
lamadasdas
like the same philosophy of it
Visaoni
it's just a syntax thing, really
lamadasdas
that its not technicaly bad, but not the best idea, etc
oh
Visaoni
with a tagged type, if you have a procedure Foo, you can call it with My_Var.Foo
with a non-tagged type, you cannot do that. You must call Foo(My_Var)
I probably should have used different variable names, but c'est la vie
lamadasdas
i like the tagged syntax better, is that bad?:D
it looks more intuitive
Visaoni
it's more similar to other languages
it's not bad, but if you find yourself tagging types /just/ for the syntax, a few (not all) people might look at you kinda funny
oliver117
it's unnecessary imo
lamadasdas
because Foo(My_Var) looks like executing an Foo procedure/method/whatever_the_name_for_that_is with argument My_Var
Visaoni
well... you are
oliver117
^
Visaoni
in any language
the dot notation is just a way of providing an implict first parameter
lamadasdas
but My_Var.Foo suggests that i'm executing procedure Foo from class/package/huh? My_Var
sooo
if you have
using Ada.Text_IO then...?
i though that i'm selecting Text_IO from Ada package
that Text_IO is in Ada
.text
and that i can do sh*t like Text_IO.WriteSomethingToConsole
Visaoni
Text_IO is package itself, inside of Ada
lamadasdas
because WriteSomethingToConsole is in Text_IO
thats not true?
simple question, does the dot behave same way as in let say c#? :D
Visaoni
as long as there is no ambiguity in what Text_IO you are talking about that seems fine
I'm not really familiar with C#, honestly
lamadasdas
ah
charlie5
(Action) likes obect,operation notation
lamadasdas
and when do i need to create package?
oliver117
Foo.Frobnicate; is identical to Frobnicate (Foo);, while Text_IO.New_Line; is very different from Text_IO (New_Line);
charlie5
but you have to phrasre it 'right' i gguess
lamadasdas
for things that i described earilier? For Chat_Server?
oliver117
New_Line (Text_IO) actually...
Visaoni
think of packages like modules
lamadasdas
btw is more common to write Chat_Server in ADA rather then ChatServer ?
« prev 1 2 3 4 5 6 7 8 9 10 11 next »