Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Julia

You're reading from   Learning Julia Build high-performance applications for scientific computing

Arrow left icon
Product type Paperback
Published in Nov 2017
Publisher Packt
ISBN-13 9781785883279
Length 316 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
Rahul Lakhanpal Rahul Lakhanpal
Author Profile Icon Rahul Lakhanpal
Rahul Lakhanpal
Anshul Joshi Anshul Joshi
Author Profile Icon Anshul Joshi
Anshul Joshi
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. Understanding Julia's Ecosystem FREE CHAPTER 2. Programming Concepts with Julia 3. Functions in Julia 4. Understanding Types and Dispatch 5. Working with Control Flow 6. Interoperability and Metaprogramming 7. Numerical and Scientific Computation with Julia 8. Data Visualization and Graphics 9. Connecting with Databases 10. Julia’s Internals

Type introspection and reflection capabilities


Type introspection and reflection capabilities form a very useful part of any modern-day programming language. Their need arises due to the fact that many a time while coding, we come across a situation where we need to understand the types of objects or data that we are dealing with. Sometimes, we may need to find the type of an object, and other times we may end up coding some logic based on that object's types and properties.

Type introspection

As we know from the starting chapters that Julia supports multiple dispatch and we can create a new data type from any abstract data type, let's define a new type, named Student, and then create two sample objects for this type:

julia> type Student
           name::String
           age::Int64
       end

julia> alpha = Student("alpha",24)
Student("alpha", 24)

julia> beta = Student("beta",25)
Student("beta", 25)

Pretty simple! Now that we have two of these students, with the names alpha and beta...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image